I started this project before I ever used Zod — I wanted to understand how schema validation/inference libraries works by building one from scratch. As I iterated on it, I realized the architecture was turning out surprisingly well, so I started using it in my internal projects. Now I consider it a full-fledged alternative to Zod with some unique features of its own, and I just published it to npm.
Some concrete numbers vs Zod v4:
- Performance: faster in 14/15 benchmarks. 1.2–2.6x on valid input, 8–204x on invalid input (early-exit optimization). Zod is ~8% faster on one union benchmark. - Bundle: 14 KB gzipped (full) vs Zod v4's 41 KB. Sub-path imports bring individual builders down to ~4 KB. - Implements Standard Schema v1, so it works with tRPC, TanStack Form, React Hook Form, T3 Env, Hono, etc.
Other things that might be of interest technically:
- Immutable fluent API — every `.method()` call returns a new builder instance - Type-safe extension system (`defineExtension()` + `withExtensions()`) as an alternative to `.refine()` — extensions are composable and introspectable - `extern()` wraps any Standard Schema v1 library (Zod, Valibot, ArkType) into a @cleverbrush/schema builder, so you can mix schemas from different libraries in one object
Zero runtime dependencies, 97.9% test coverage. BSD-3-Clause.
Docs with an interactive playground (no install required): https://docs.cleverbrush.com?utm_source=hackernews&utm_mediu...
Happy to answer questions about the architecture, the benchmarks, or the PropertyDescriptor design.