fnType-safe validation library

Type-safe form validation without the boilerplate

Formify is a lightweight, dependency-free validation library for JavaScript and TypeScript. Define schemas once, validate everywhere — with full type inference and readable errors.

// Zero dependencies · Full type inference · Framework agnostic

0

Dependencies

<3kb

Bundle size

100%

Type inference

schema.ts

1
import { schema } from "formify"
2
3
const user = schema({
4
name: string(),
5
email: email(),
6
age: number().min(18),
7
});
8
9
const result = user.validate(input);
10
✓ name is valid
11
✗ email must be a valid email address

inferred type

User

bundle

<3kb

> schema().validate()
> type inference
> nested objects
> arrays
> custom rules
> zero deps
> any framework
> schema().validate()
> type inference
> nested objects
> arrays
> custom rules
> zero deps
> any framework
0

Dependencies

<3kb

Bundle footprint

100%

Type-safe

1

Schema, everywhere

// Features

Validation that keeps up with your code

Designed for modern JavaScript and TypeScript projects, Formify makes validation simple, safe, and fast.

schema({ ... })

Type-safe schemas

Schemas are fully typed — your validated data is inferred automatically with zero manual annotations.

string().custom(fn)

Composable rules

Chain built-in validators or write custom ones. Reuse rules across forms, APIs, and projects.

import { schema }

Zero dependencies

Tiny footprint, no runtime deps. Works in browsers, Node.js, and edge runtimes out of the box.

result.errors()

Clear error messages

Human-readable errors with field-level context, ready to display directly in your UI.

object({ nested })

Nested & arrays

Validate deeply nested objects and arrays of any shape with the same simple schema syntax.

schema.validate(input)

Framework agnostic

Use it with React, Vue, Svelte, or plain JavaScript — no framework-specific APIs required.

// Use cases

Perfect for every form

From simple signup forms to complex multi-step workflows, Formify handles it all.

SignupAuth & registration
ProfilesUser settings
PaymentsCheckout data
APIsRequest bodies
SearchQuery filters
ConfigApp settings
Multi-stepWizard flows
UploadsFile metadata
ContactsAddress books
CommentsUser content

// Why Formify

One schema, everywhere

Validate user input on the client, then reuse the exact same schema on the server. No duplication, no drift between your forms and your API — Formify keeps validation logic in one place.

  • Full TypeScript inference — types flow from schema to UI
  • Predictable, dependency-free runtime behavior
  • Localized, customizable error messages out of the box
  • Works on the server and the client with the same API

client.ts

// One schema, everywhere

const schema

= schema( "user" )

// Full TypeScript inference — types flow from schema to UI

// Predictable, dependency-free runtime behavior

schema.validate(input)

✓ types inferred

server.ts

// One schema, everywhere

const schema

= schema( "user" )

// Full TypeScript inference — types flow from schema to UI

// Predictable, dependency-free runtime behavior

schema.validate(input)

✓ types inferred

// FAQ

Questions, answered

Ready to validate better forms?

Get started with Formify in minutes. Read the docs, define your first schema, and start validating — client and server.

$ npm install formify