Command Palette

Search for a command to run...

position in category
#7

Lightweight runtime schema validation library for JavaScript and TypeScript. Lets you define data shapes with a type-like API inspired by TypeScript, Flow, Go, and GraphQL, then validate arbitrary input and receive detailed errors instead of silent failures.

Created by the author of Slate.js. Stands out for its minimal footprint and composable design: structs nest cleanly, and custom validators plug in via a simple define API. Compared to heavier alternatives like Zod or Yup, it keeps the surface area small while covering the common cases.

Key capabilities:

  • Composable struct definitions for objects, arrays, and nested shapes
  • Assert, validate, or is: throw errors, return error tuples, or check validity without throwing
  • Coercion and default values via create and defaulted
  • Custom validators with define for UUIDs, emails, and domain-specific formats
  • TypeScript inference so validated data gets proper types automatically

Developers use Superstruct to validate request payloads in REST or GraphQL APIs, sanitize external input, and enforce schemas on internal data structures. Fits well with API layers, form handling, and any place where runtime guarantees matter beyond compile-time types.

GitHub Repositories
18
-14.3%
Trending down this week
Removed in 3 repos