Schema validators
envin supports any schema validator that implements the Standard Schema specification.
envin
supports any schema validator that implements the Standard Schema specification. This means you can use your preferred validation library without being locked into a specific one.
What is Standard Schema?
Standard Schema is a common interface designed to be implemented by JavaScript and TypeScript schema libraries. It allows ecosystem tools like envin
to accept user-defined type validators without needing custom logic or adapters for each supported library.
The specification consists of a single TypeScript interface StandardSchemaV1
that validation libraries can implement. This provides:
- Runtime validation - Validate data and get standardized error messages
- Static type inference - Extract TypeScript types from schemas
- Library interoperability - Switch between validation libraries without changing your code
- Zero runtime dependencies - The spec is types-only
Examples
envin
works with any library that implements Standard Schema. Here are the most popular options:
Zod
Zod is a TypeScript-first schema validation library with static type inference.
Valibot
Valibot is a modular and type-safe schema library with bundle size optimization.
ArkType
ArkType provides TypeScript syntax at runtime with excellent performance.
Effect Schema
Effect Schema is part of the Effect ecosystem with advanced composition capabilities.
Mixing libraries
Since all Standard Schema-compliant libraries use the same interface, you can even mix different validation libraries in the same configuration:
Why it's important?
Standard Schema enables:
- Ecosystem compatibility - Tools can support multiple validation libraries without custom integrations
- Developer choice - Pick the validation library that best fits your needs
- Future-proofing - Switch libraries without rewriting your configuration
- Reduced bundle size - No need for adapter libraries or wrappers
For more information about Standard Schema, visit standardschema.dev.