A curated drawer of JavaScript validation, schema, and runtime type-checking libraries worth reachingĀ for.

Schema validation

Define a schema once, then validate and infer types fromĀ it.

ResourceWhy it is useful
superstructComposable, tiny schema validation with great error messages.
typedMinimal schema validation with TypeScript inference.
runtypesRuntime validation that derives static types; examples linked.
ts-to-zodGenerate Zod schemas from existing TypeScript types.
valid-typesLightweight, simple validation; single-file source.

Runtime type checking and assertions

ResourceWhy it is useful
owExpressive argument-validation / assertion library for function inputs.

Input and value validators

ResourceWhy it is useful
validator.jsBattle-tested string validators and sanitizers (email, URL, etc.).
node-input-validatorRule-string validation, e.g. name\|required\|min:5.

JSON Schema

ResourceWhy it is useful
ajvFast JSON Schema validator, the de facto standard.