Vest ✅ Declarative validations framework
See the code
Documentation · Async race demo · Getting started
Vest runs the tests for the field or step that changed and keeps the results for everything else. When async checks overlap, only the latest result can update the suite.
Vest validates what changed, remembers what already passed, and prevents stale async validation results.
The validation rules read like unit tests. The stateful runtime is what makes Vest different.
import { create, enforce, test } from 'vest';
const suite = create(data => {
test('username', 'Username is required', () => {
enforce(data.username).isNotBlank();
});
test('username', 'Username must be at least 3 characters', () => {
enforce(data.username).longerThanOrEquals(3);
});
test('username', 'Username is already taken', async ({ signal }) => {
const response = await checkUsername(data.username, { signal });
enforce(response.available).isTruthy();
});
});
// Run only username tests and retain previous results for every other field.
const result = suite.only('username').run(formData);
result.isPending('username');
result.hasErrors('username');
// Await the current async run when final completion matters.
await result;
run() and runStatic() as Vest's execution APIs.| Layer | Responsibility | Typical tools |
|---|---|---|
| Form state | Values, registration, touched state, submission | React Hook Form, Formik |
| Data boundary | Parse and protect a complete payload | Zod, Valibot, Ajv, Enforce schemas |
| Validation state | Decide what runs now, retain results, coordinate async work | Vest |
These layers are complementary. A common architecture uses a form manager for input mechanics, Vest for progressive interaction, and a schema validator for the final submitted boundary.
Vest works well for:
For a trivial synchronous form or a one-shot API parse, native HTML validation or a schema validator may be all you need.
npm i vest
Contributions are welcome. See CONTRIBUTING.md.
Overall
Maintained
Code review
npm
Latest release
Releases this year
13,581 followers · starred Dec 2023
108 followers · starred Mar 2026
465 followers · starred Dec 2023
110 followers · starred Jul 2021
Vest ✅ Declarative validations framework
See the code
Documentation · Async race demo · Getting started
Vest runs the tests for the field or step that changed and keeps the results for everything else. When async checks overlap, only the latest result can update the suite.
Vest validates what changed, remembers what already passed, and prevents stale async validation results.
The validation rules read like unit tests. The stateful runtime is what makes Vest different.
import { create, enforce, test } from 'vest';
const suite = create(data => {
test('username', 'Username is required', () => {
enforce(data.username).isNotBlank();
});
test('username', 'Username must be at least 3 characters', () => {
enforce(data.username).longerThanOrEquals(3);
});
test('username', 'Username is already taken', async ({ signal }) => {
const response = await checkUsername(data.username, { signal });
enforce(response.available).isTruthy();
});
});
// Run only username tests and retain previous results for every other field.
const result = suite.only('username').run(formData);
result.isPending('username');
result.hasErrors('username');
// Await the current async run when final completion matters.
await result;
run() and runStatic() as Vest's execution APIs.| Layer | Responsibility | Typical tools |
|---|---|---|
| Form state | Values, registration, touched state, submission | React Hook Form, Formik |
| Data boundary | Parse and protect a complete payload | Zod, Valibot, Ajv, Enforce schemas |
| Validation state | Decide what runs now, retain results, coordinate async work | Vest |
These layers are complementary. A common architecture uses a form manager for input mechanics, Vest for progressive interaction, and a schema validator for the final submitted boundary.
Vest works well for:
For a trivial synchronous form or a one-shot API parse, native HTML validation or a schema validator may be all you need.
npm i vest
Contributions are welcome. See CONTRIBUTING.md.
Overall
Maintained
Code review
npm
Latest release
Releases this year
13,581 followers · starred Dec 2023
108 followers · starred Mar 2026
465 followers · starred Dec 2023
110 followers · starred Jul 2021