tRPC – Move Fast and Break Nothing. End-to-end typesafe APIs made easy

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
  • fern

    🌿 Stripe-level SDKs and Docs for your API

  • I think part of why tRPC shines is because it's tightly coupled to TypeScript (and especially Zod, its schema validation library of choice - many of its features map 1:1 onto TypeScript concepts that don't exist in many other languages), which means it can avoid many of the issues that OpenAPI generators have. I'd also like to see a good TS-first OpenAPI client - Fern [0] is probably the closest I've seen.

    In general in my experience, when you take away the constraint of inter-language interop, you get much smoother DX because you can take advantage of language features. A good example would be the lack of native date/time types in JSON - valuable for interop because different languages handle dates differently, but painful when you're going to/from the same language. Web applications are a special case, because the client-side is effectively constrained to either JavaScript or WebAssembly (except you'd still need at least some JS in the latter case), so it follows that you'll get the best developer DX if you have JS or TS on both sides of the stack, especially if you can set up your project in a way that lets you share code between both. Not always an option, but I've always felt more productive (as a full-stack dev) when I've been using TS on both the client and server, compared to TS on the client and another language on the backend.

    [0]: http://buildwithfern.com/

  • telefunc

    Remote Functions. Instead of API.

  • Compared with tRPC: https://github.com/brillout/telefunc/issues/9

  • 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
  • create-t3-app

    The best way to start a full-stack, typesafe Next.js app

  • I've used tRPC and Next.js for a couple of personal projects and it's been a great experience. Hard to beat on iteration speed, especially when used with a pre-configured template like Create T3 App: https://create.t3.gg/.

  • openapi-typescript-codegen

    NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification

  • In our current project with a TS frontend and Python backend, we use an OpenAPI schema as the source of truth and openapi-typescript-codegen [0] to interface with it on the client side. While not perfect, it provides a very nice interface to our API with request/response typings.

    I also wrote a 10-line mock API wrapper that you can call as mockApi((request) => response), and it will type-check that your mock function implements the API correctly.

    [0]: https://github.com/ferdikoomen/openapi-typescript-codegen

  • wundergraph

    WunderGraph is a Backend for Frontend Framework to optimize frontend, fullstack and backend developer workflows through API Composition.

  • I'm a big fan of tRPC. It's amazing how it pushed TypeScript only stacks to the limit in terms of DX. Additionally, it made the GraphQL community aware of the limitations and tradeoffs of the Query language. At the same time, I think tRPC went through a really fast hype cycle and it doesn't look like we're seeing a massive move away from REST and GraphQL to RPC. That said, we see a lot of interest in RPC these days as we've adopted some ideas from tRPC and the old NextJS. In our BFF framework (https://wundergraph.com/) we've combined file based routing with RPC. In addition to tRPC, we're automatically generating a JSON Schema for each operation and an OpenAPI spec for the whole set of operations. People quite like this approach because you can easily share a set of RPC endpoints as an OpenAPI spec or postman collection. In addition, there are no discussions around HTTP verbs and such, there's only really queries, mutations and subscriptions. I'm curious what other people's experiences are with GraphQL, REST and RPC style APIs? What are you using these days and how many people/teams are involved/using your apis?

  • ts-simple-type

    Relationship type checker functions for Typescript types.

  • We use an internal validator library that we infer request types from. It’s similar to Zod (but also predates it by a year).

    I’ve also spent some time on a Typescript type to X compiler. My first prototype is open source and targets Thrift, Proto3, Python, and JSON schema: https://github.com/justjake/ts-simple-type/tree/main/src/com...

    I’m not happy with the design decision in that codebase to try to “simplify” Typescript types before compiling, and probably won’t continue that implementation, but we have a few internal code generators that consume TS types and output test data builders and model clases we use in production.

  • protobuf-ts

    Protobuf and RPC for TypeScript

  • DX for front or back end? The beauty of tRPC is that the types are derived/inferred from the backend runtime code (like, as you type). It would be nigh impossible to do that with grpc(-web) using proto files as the source of truth.

    It's possible there's a project out there which could automatically produce proto files from something like zod, json-schema, etc. which could be directly interpreted by TS to provide similar (as you type) DX while still allowing some other language backend to consume the derived proto files (though the DX there would be less than ideal).

    If you're just looking for similar TS clients/interfaces for grpc-web then I'd recommend https://github.com/timostamm/protobuf-ts which operates on plain JS objects (no new MyMessage().serialize(), instead the code generator mostly produces TS interfaces for you to work against: const myMessage: MyMessage = pojoConformingToInterface; const binary = MyMessage.toBinary(myMessage);)

  • 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
  • trpc

    🧙‍♀️ Move Fast and Break Nothing. End-to-end typesafe APIs made easy.

  • It is. But RSC make many library authors and maintainers question whether their library is still needed in a RSC world and if so how they can support it. Same story with tRPC https://github.com/trpc/trpc/issues/3297

  • garph

    Fullstack GraphQL Framework for TypeScript

  • If you want something like tRPC but for GraphQL, you should definitely give Garph a try: https://garph.dev

  • stytch-t3-example

    An example app demonstrating how to use Stytch within the T3 stack

  • I hadn't heard of tRPC until a developer I was working with raved about it and it just seemed like such an obvious good after I learned about it.

    We built a T3 app (tRPC, Next.js, Tailwind, TypeScript, Prisma) together (if you'd like to check it out https://github.com/stytchauth/stytch-t3-example).

    Type safe APIs while working in TypeScript is just so helpful.

  • transmission-material-ui

    Web Interface for Transmission using React and MUI.

  • electron-trpc

    Build type-safe Electron inter-process communication using tRPC

  • Dropping in a tRPC use case that I've really got a lot of mileage out of: communication between the Electron main and renderer processes using https://github.com/jsonnull/electron-trpc. Traditional Electron IPC is hard to do type safely, which electron-trpc solves, and the react-query integration (meaning you get automatic type-safe hooks to issue the requests) is really nice.

  • trpc-openapi

    OpenAPI support for tRPC 🧩

  • Sure it can, you can use https://github.com/prosepilot/trpc-openapi

  • zod

    TypeScript-first schema validation with static type inference

  • oto

    Go driven rpc code generation tool for right now. (by pacedotdev)

  • fern-java

    Discontinued Generate Java models, clients, and server interfaces from your API definition.

  • You can recommend it in what context, from openapi (as they claim https://github.com/fern-api/fern#starting-from-openapi ) or from their ... special ... definition schema?

    For those wanting less talk, moar code: https://github.com/fern-api/fern-java/blob/0.4.2-rc3/example... -> https://github.com/fern-api/fern-java/blob/0.4.2-rc3/example...

  • typed-graphql-builder

    A fully type-safe graphql query builder, inspired by tql

  • I'm honestly pretty happy with TypeGraphQL. TypeGraphQL works code-first and lets you integrate request-scoped DI for resolvers, which makes writing more complex resolves significantly more pleasant.

    Admittedly for the front end I couldn't find a satisfactory tool so I built typed-graphql-builder (https://typed-graphql-builder.spion.dev/). You do have to run it if your backend schema changes, but not when your queries change as the queries are written in typescript and inferred on the fly. (I should probably write a watch mode for the cli, that should largely take care of the rest of the toil when quickly prototyping)

  • vellum-client-generator

    Vellum’s Fern API which is used to generate SDKs.

  • vellum-client-python

    Python SDK for Vellum API

  • sdk-fern

    Squidex’s Fern API which is used to generate SDKs.

  • sdk-node

    Node.js SDK for the Squidex API

  • crosswalk

    Typed express router for TypeScript

  • I built something that sounds very similar at my last company called crosswalk. Open sourced here: https://github.com/danvk/crosswalk

    One thing that worked surprisingly well: codegen TypeScript types from your database and use those in your API schema.

  • openapi-typescript

    Generate TypeScript types from OpenAPI 3 specs

  • Another great library to generate TS types from OpenAPI is https://github.com/drwpow/openapi-typescript . It provides the types as single objects you access via indexing, which is pretty nice. There's a partner library to generate a typed fetch client.

  • zact

    Discontinued Nothing to see here

  • You can use zact for that

    https://github.com/pingdotgg/zact

  • ts-websocket-compressor

    This library compresses data sent over a WebSocket connection to improve throughput on devices that can't use compression for one reason or another.

  • Update: I've implemented a simple TS library around this: https://github.com/TimonLukas/ts-websocket-compressor

    I will add wrappers for WebSocket/WebSocketServer in the future to allow using this without the library having to support it, like in the PoC with trpc.

  • datamodel-code-generator

    Pydantic model and dataclasses.dataclass generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.

  • Like generating pydantic models or dataclasses for an OpenAPI schema? I haven't needed to go in that direction myself, but this[0] looks promising!

    Apologies if I've misunderstood your comment

    https://koxudaxi.github.io/datamodel-code-generator/

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS 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