Zod: TypeScript-first schema validation with static type inference

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • zod

    TypeScript-first schema validation with static type inference

    Does/will this correctly handle `| undefined` vs `?`, i.e. correct behavior under `exactOptionalPropertyTypes`?

    Zod doesn't (yet[0]) and it's been a pain point for me.

    [0] https://github.com/colinhacks/zod/issues/635

  • CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  • typespec

    Does anyone have a nice combination of tooling for typed handlers + client generation.

    Thinking maybe Zod + Zod open API.

    Really looking to replicate similar spec first workflow similar to protobuf services.

    https://typespec.io/ also looks promising but seems early.

  • TypeScript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • valibot

    The modular and type safe schema library for validating structural data 🤖

    It seems I'm not the first person to make this observation: https://github.com/fabian-hiller/valibot/issues/687

    I honestly don't want my validation library to "tell a story" at the expense of documentation clarity. It's absolutely fine that this project uses it, I don't want to impose my view on them - I guess it's just not the validation library for me.

  • typescript-runtime-type-benchmarks

    đź“Š Benchmark Comparison of Packages with Runtime Validation and TypeScript Support

    Something cool that I can't remember if it was posted on HN at one point or I stumbled across when looking for alternatives to yup but this repo has been compiling a bunch of different benchmarks for runtime validation of ts validation libraries. Obviously to some degree the performance is arbitrary when you're reaching millions of operations per second but on the flipside their benchmarks are against rather data. Would be interested to see comparison of either more nested data or otherwise complex. Maybe something to look at in my spare time.

    https://moltar.github.io/typescript-runtime-type-benchmarks/

  • decoders

    Elegant validation library for type-safe input data (for TypeScript and Flow)

    I really like the Decoders library for this. Similar in function to Zod, but a more Elm inspired approach - https://decoders.cc/

  • typebox

    Json Schema Type Builder with Static Type Resolution for TypeScript

    I'd recommend TypeBox[1] as an alternative, which has a runtime “compiler” for generating optimized JS functions from the type objects. It also produces a JSON schema, which can be useful for generating API docs and API clients if needed.

    It also has a companion library[2] for generating TypeBox validators from TypeScript definitions, which I'm currently using in an RPC library I'm working on.

    [1]: https://github.com/sinclairzx81/typebox

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  • typebox-codegen

    Code Generation for TypeBox Types

  • haxe.io

    The home of the Haxe Roundup's (Work in Progress)

    It is. And only getting better SLOWLY by each iteration. The thing i love about Haxe that once you use it, your installed version is not legacy in a month (unlike npm/typescipt ecosystem). Haxe is fully working, and does not need a lot of "new" features.

    More news about Haxe can be found here: https://haxe.io/ (the old blog is not updated AFAIK)

  • typia

    Super-fast/easy runtime validators and serializers via transformation

  • typeschema

    🛵 Universal adapter for TypeScript schema validation.

    When there’s feature parity, what’s the next differentiator for you? For me, performance.

    Though I admit another important aspect is community adoption. If your 3rd-party dependency uses zod internally, well now you’re bundling in both, and the added network latency probably negates any performance improvement you were getting. That’s why I wish libraries would use something more generic that allows you to dependency-inject what you’re already using, like https://github.com/decs/typeschema

  • Fable: F# |> BABEL

    F# to JavaScript, TypeScript, Python, Rust and Dart Compiler

    Why not write your code in F# and compile it to TypeScript using Fable [1]?

    This way you can use native language features for discriminated unions, functional pipelines, and exhaustive pattern matching to model your domain instead of shoe-horning such functionality into a non-ML language!

    Model your domain in F#, consume it in Python or C# backends and TypeScript frontends. The downside is needing to know all of these languages and run times but I think I'd rather know F# and the quirks with interacting with TypeScript than a library like Effect!

    [1] https://fable.io

  • bs-json

    Discontinued Compositional JSON encode/decode library for BuckleScript

    Coming from a ReasonML / OCaml codebase (frontend react), I'm seeing a lot to love with the pattern matching and sum types. Zod is already one of my favorites (coming from https://github.com/glennsl/bs-json).

    Is 'retry / observability / error handling" something that comes from Effect?

  • Scalaz

    Principled Functional Programming in Scala

    You just gave me a flashback to scalaz https://github.com/scalaz/scalaz

  • ajv

    The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)

    I'm not 100% sure, they most likely scraped the author emails of all NPM packages that (transitively) depend on ajv. Here's the GitHub issue from back then: https://github.com/ajv-validator/ajv/issues/1202

  • dittofeed

    Open-source customer engagement. Automate transactional and marketing messages across email, SMS, mobile push, WhatsApp, Slack, and more 📨

    Likewise we use typebox for everything in our project (open source customer.io alternative).

    https://github.com/dittofeed/dittofeed/blob/main/packages/is...

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Show HN: Universal adapter for TypeScript schema validation

    1 project | news.ycombinator.com | 6 Oct 2023
  • Show HN: TypeSchema – Universal adapter for TypeScript schema validation

    1 project | news.ycombinator.com | 7 Jul 2023
  • 🛵 TypeSchema – unified interface for schema validations (zod, yup...)

    1 project | /r/typescript | 5 Jul 2023
  • We're building Bridge-Mongo: a fully typed MongoDB ORM, built on top of Mongoose.

    2 projects | /r/node | 10 Feb 2023
  • Better Backend DX: JSON Schema + TypeScript + Swagger = ✨ Vol. 2

    1 project | dev.to | 20 May 2022

Did you konow that TypeScript is
the 2nd most popular programming language
based on number of metions?