Show HN: Build type-safe web APIs with JavaScript, instantly

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

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • api

    Instant API: Build type-safe web APIs with JavaScript (by instant-dev)

  • FastAPI

    Easily create robust, standardized API endpoints using lightning-fast database queries (by thestorefront)

  • Interestingly I published a Ruby framework called FastAPI before Python’s FastAPI existed ;) — been thinking about this stuff for a long time.

    https://github.com/thestorefront/FastAPI

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • presupplied

  • We tried for years to do things like this, and in the end an approach using typescript is way, way better than anything else I've seen attempted.

    In my latest project[1], we set up the types for the API. The server and client are both bound by those types, meaning that one cannot change without the other. This fixes an entire class of bugs where backend code gets updated without the corresponding front-end code changing or vice-versa. It also has the nice side-effect that all of the possible return values (including errors) are nicely documented in one file, and that the errors are very consistent. On the frontend we have a "typed fetch" which returns typed results from the API.

    We are also using this for typed access to localStorage, another source of many bugs in past projects, where random keys end up being scattered and causing nondeterministic behavior on different devices.

    You can see how our API type system is implemented here:

    common types for both client and server: https://github.com/stoarca/presupplied/blob/master/images/ps...

    client's typed fetch: https://github.com/stoarca/presupplied/blob/master/images/ps...

    server's typed endpoint definitions: https://github.com/stoarca/presupplied/blob/master/images/ps...

    [1]: We are working on https://app.presupplied.com, a digital home-schooling curriculum to teach 3-year-olds to read. Planning to expand to math, writing, and programming.

  • zod

    TypeScript-first schema validation with static type inference

  • zod-to-openapi

    A library that generates OpenAPI (Swagger) docs from Zod schemas

  • And if you like Zod, you might as well use this: https://github.com/asteasolutions/zod-to-openapi

    It converts Zod types to OpenAPI specification.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB 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