Skip to content

Ajv vs Formily

Which should you use? A side-by-side look at what each one does, who it suits, what it costs, how hard it is to set up, and where each falls short.

Ajv

Open source · MIT

A fast library that checks whether JSON data matches a schema, for Node.js and browsers.

Formily

Open source · MIT

A form library for React and Vue that handles complex and JSON-schema-driven forms.

The short answer

Choose Ajv if you need…

  • Node.js developers validating API request or response bodies
  • Front-end developers validating form or config data in the browser
  • Teams already writing JSON Schema who need a standards-based checker
  • Projects that need draft-04 support (via the separate ajv-draft-04 package)

Choose Formily if you need…

  • Frontend developers building data-heavy forms with many linked fields
  • Teams that want forms generated from JSON Schema sent by a back end
  • Projects already using Ant Design or Alibaba Fusion components
  • Teams that want a visual form builder (Designable) alongside the library

Side-by-side

AjvFormily
TypeLibraryLibrary
PriceFree and open sourceFree and open source
LicenceMITMIT
GitHub stars14.9k12.6k
Setup difficultyIntermediateIntermediate
How you get itInstall with a package managerInstall with a package manager
Main languageTypeScriptTypeScript
Last code update2 months ago17 months ago

What each one is

Ajv

Ajv is a JavaScript/TypeScript library that checks JSON data against a schema, such as confirming a form submission or API request has the required fields and types. It supports JSON Schema drafts 04, 06, 07, 2019-09 and 2020-12, plus JSON Type Definition (RFC 8927). The README describes it as fast, and it generates validation code from schemas to achieve this.

Formily

Formily is a TypeScript form library that helps developers build forms in React, React Native, Vue 2, and Vue 3. It manages each field's state separately so large forms with many linked fields don't re-render the whole page. It also supports JSON Schema, so forms can be described as data, for example by a back end.

Best for

Ajv

  • Node.js developers validating API request or response bodies
  • Front-end developers validating form or config data in the browser
  • Teams already writing JSON Schema who need a standards-based checker
  • Projects that need draft-04 support (via the separate ajv-draft-04 package)

Formily

  • Frontend developers building data-heavy forms with many linked fields
  • Teams that want forms generated from JSON Schema sent by a back end
  • Projects already using Ant Design or Alibaba Fusion components
  • Teams that want a visual form builder (Designable) alongside the library

Strengths

Ajv

  • The README claims it is the fastest JSON schema validator and cites third-party benchmarks
  • Supports multiple JSON Schema drafts and JSON Type Definition
  • MIT licensed with a large community (over 100 contributors per the README)

Formily

  • The README says field state is managed independently, which aims to avoid slow re-renders in linked forms
  • Supports converting between JSON Schema and its own JSchema format
  • Released under the permissive MIT license

Not ideal for

Ajv

  • People who are new to programming and just want a simple form library, since it requires writing schemas
  • Projects that need a non-JavaScript runtime, since the README only mentions Node.js and browsers
  • Users who only need to check a few values by hand, where a simple function would be enough

Formily

  • Simple forms with a few inputs, where a lighter library is enough
  • Projects not using React or Vue, since the README lists only those frameworks
  • Non-developers who want a no-code form tool; the README describes it as a developer library

Trade-offs

Ajv

  • Draft-04 support requires an extra package, so setup is not one step for older schemas
  • The README is short and points to an external website for most documentation
  • Performance claims come from the project's own README citing older benchmarks

Formily

  • The README is short and covers little API detail, so setup needs the official documentation site
  • The README mentions two website versions (1.0 and 2.0), so check you are reading the right docs

Getting started

Ajv

Install the package

npm install ajv
Step-by-step guide: how to use Ajv

Formily

Install the core package

npm install @formily/core
Step-by-step guide: how to use Formily

Frequently asked questions

What is the difference between Ajv and Formily?

Ajv: A fast library that checks whether JSON data matches a schema, for Node.js and browsers. Formily: A form library for React and Vue that handles complex and JSON-schema-driven forms. Ajv suits node.js developers validating api request or response bodies, while Formily suits frontend developers building data-heavy forms with many linked fields.

Are Ajv and Formily free?

Ajv: Free and open source. Formily: Free and open source.

Is Ajv or Formily more popular?

Ajv has more GitHub stars (14.9k) than Formily (12.6k). Popularity isn't the same as fit — check which one matches your use case above.

What are other alternatives to Ajv and Formily?

Other options people compare them with include Zod, Pydantic, SQLModel, React Hook Form, VeeValidate.

Keep comparing

Built from our catalogue entries for both products: open-source details come from each project's README (AI-assisted, refreshed weekly) and GitHub data; AI-tool details are editorial. Spotted something wrong? Let us know from either product's page.