TinyValidate
A lightweight, type-safe form validation library for TypeScript designed for modern applications. TinyValidate helps developers build reliable forms with minimal overhead, providing powerful validation features without adding unnecessary dependencies.
Get Started View on GitHub npm PackageWhy TinyValidate?
TinyValidate was built to solve a common problem: form validation libraries are often large, complex, and difficult to customize. TinyValidate focuses on simplicity, performance, and developer experience.
Type-Safe by Default
Leverage TypeScript’s type system to improve the development experience and enhance overall code reliability.
Zero Dependencies
No external dependencies means a smaller bundle size, fewer security concerns, and faster installs.
Flexible Validation Rules
Create custom validators or use built-in validation utilities to fit your application’s requirements.
Tiny Bundle Size
Designed to remain lightweight and fast, making it suitable for both small and large-scale applications.
Features
- Type-safe validation
- Custom validation rules
- Schema-based validation
- Form field validation
- Error handling utilities
- Lightweight and dependency-free
- Modern TypeScript support
- Easy integration with React, Vue, Angular, and other frameworks
Example Use Cases
- User registration forms
- Login and authentication workflows
- Checkout and payment forms
- Admin dashboards
- Internal business applications
- API request validation
Get Started
TinyValidate installs from npm and runs on Node.js 16 and later with no runtime dependencies.
npm install @mindrops/tinyvalidate # or pnpm add @mindrops/tinyvalidate # or yarn add @mindrops/tinyvalidate
import { object, string, number } from "@mindrops/tinyvalidate";
// 1. Describe the shape of the value
const UserSchema = object({
name: string().min(3).max(40),
email: string().email(),
age: number().min(18)
});
// 2. Validate without throwing
const result = UserSchema.safeParse(input);
// 3. Handle both outcomes
if (result.success) {
console.log(result.data); // typed { name, email, age }
} else {
console.log(result.errors); // [{ path, message, code }, ...]
}
A failed safeParse() reports every issue in one pass rather than stopping at the first. Where an exception is preferred, .parse() throws a ValidationError carrying the same issues, with .flatten() and .format() helpers for presentation.
Package details
- Current version
- 0.1.1
- Supported Node versions
- Node.js 16 and later
- License
- MIT License
- npm package
@mindrops/tinyvalidate- Module formats
- ESM and CommonJS, with bundled types
- Runtime dependencies
- None
Documentation
Comprehensive documentation includes installation guides, API references, examples, and best practices to help developers get started quickly.
Read DocumentationOpen Source
TinyValidate is open source and welcomes contributions from the community. Feature requests, bug reports, and pull requests are encouraged.
Contribute on GitHubAbout Mindrops
TinyValidate is maintained by Mindrops as part of its commitment to building practical open-source developer tools and modern JavaScript infrastructure.
Explore More Open Source Projects