Forgeform
Lightweight, TypeScript-First Form Validation
npm install forgeform
Intuitive DSL
Define schemas effortlessly with a clean, JSON-like syntax.
1import { createSchema } from 'forgeform'; 2 3const schema = createSchema({ 4 name: 'string', 5 age: 'number' 6});Robust Validation
Type-safe validation with sanitization, regex, and custom validators.
1const result = schema.validate({ 2 name: 123, // Invalid 3}); 4 5console.log(result.isValid); // falseReact Hook Form Ready
Seamless integration with React Hook Form for easy state management.
1import { useForm } from 'react-hook-form'; 2import { forgeFormResolver } from 'forgeform/react'; 3 4useForm({ resolver: forgeFormResolver(schema) });Regex Powerhouse
50+ built-in regex patterns + custom regex builder for complex formats.
1import { buildRegex } from 'forgeform/regexBuilder'; 2 3const zipRegex = buildRegex({ type: 'zip' }).source; 4Highly Extensible
Extend and customize validators, sanitizers, and patterns as needed.
1schema.addValidator('isEven', 2 (value) => value % 2 !== 0 ? 'Must be even' : undefined 3);Wizard Forms
Multi-step forms with state, validation, lifecycle hooks, and progress tracking.
1import { createWizard } from 'forgeform'; 2 3const wizard = createWizard([ 4 { id: 'step1', schema: schema1 }, 5 { id: 'step2', schema: schema2 } 6]);