TinyValidate validates forms and API payloads against typed schemas
A lightweight, TypeScript-first schema validation library for JavaScript and TypeScript — validate forms, API payloads and config with zero dependencies.
Get Started View on GitHub npm PackageHow TinyValidate is designed
TinyValidate keeps schema validation small and easy to customize: typed schemas, built-in and custom rules, and no runtime dependencies.
Type safety
Use 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.
Custom validation rules
Create custom validators or use built-in validation utilities to fit your application’s requirements.
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
Use cases
- User registration forms
- Login and authentication workflows
- Checkout and payment forms
- Admin dashboards
- Internal business applications
- API request validation
Installation and usage
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.2
- 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
The documentation covers installation, the API reference, examples and recommended practices.
Read DocumentationContributing
TinyValidate is open source and welcomes contributions from the community. Feature requests, bug reports, and pull requests are encouraged.
Contribute on GitHubFrequently asked questions
How do I install TinyValidate?
npm install @mindrops/tinyvalidate, or use pnpm add @mindrops/tinyvalidate or yarn add @mindrops/tinyvalidate.Does TinyValidate work with React, Vue or Angular?
How does TinyValidate report validation errors?
safeParse() reports every issue in one pass, each with a path, message and code. If you prefer exceptions, .parse() throws a ValidationError carrying the same issues, with .flatten() and .format() helpers for presentation.Which Node.js versions and module formats are supported?
What licence is TinyValidate released under, and where is the source?
About 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


