Building Typesafe APIs with tRPC & TypeScript

QCon San Francisco 2022

Session Frontend

Building Typesafe APIs with tRPC & TypeScript

Wednesday Oct 26 / 11:50AM PDT, Pacific DEKJ

Abstract

When developing modern APIs, there a few options to choose from. REST is not a standard  but instead style. Trust is constantly broken between the API and client. gRPC and GraphQL provide standards but require complex tooling.

Achieving a consistency in data, as well as a great developer experience seemed impossible until now. tRPC exist to provide type safety end to end, ensuring the contract for the API boundary can be trusted by default. Join me in learning how to build typesafe APIs with tRPC and TypeScript and staying cutting edge with the tooling to do it.

Tools learned:

  • typescipt
  • trpc
  • create-t3-app

Interview

In the past couple of months I've been working on building an open source platform to get people excited about contributing, but also helping companies to finance open source, and most recently have been building APIs to support that work.

The motivation behind this talk is that we were exploring building an API for the product that I was working on, and there's a lot of tools out there. It's been a while since I've built brand new APIs, so I've been hearing about tRPC for a while from friends and other engineers that I've worked with, so I decided to take the plunge, do some research, and this talk itself is the culmination of all that research.

The target audience is front-end or full stack devs that are working in JavaScript or TypeScript and looking for what's next or what's new about building APIs. So if you're working on a front-end app, this will be valuable to you because you'll know how to build your own API without waiting for a back-end team. If you are a back-end engineer, and you want to help support front-end engineers, you'll also have a good understanding of how you could support this with end-to-end type safety.

I would say that the entire approach of TypeScript has changed in the last year with these new updates and how ergonomic it's become. I think if you haven't tried TypeScript, definitely try it out now and hopefully this talk will get you interested in that. But also tRPC is only a couple of years old, so this is now the time. It's really early. There's still lots of missing documentation, which I'll mention in my talk, but really I would love for people to walk away excited about working with this technology and helping support the community in open source and creating documentation, examples, etc. 

Topics

Frontend Application Programming Interface TypeScript REST gRPC GraphQL Languages
76% senior dev or higher
1:11 speaker ratio
60+ practitioners

QCon San Francisco 2022 is a three day conference for senior software engineers, architects and team leads. An international program committee of working engineers selects every session. Patterns and practices, not products and pitches.

Share

From the same track

Wednesday 26 October

10:35 Ballroom BC Session Frontend Everyone Can Be a Full-Stack Engineer Alex Cole Software Engineer @convex_dev, previously @Asana 11:50 Pacific DEKJ Session Frontend Building Typesafe APIs with tRPC & TypeScript Brian Douglas Co-founder and CEO @Paper Compute Co. 13:40 Pacific DEKJ Session What the Data Says: Emerging Technical Trends in Front-End and How They Affect You Laurie Voss Head of Developer Relations @Arize AI, Co-Founder of npm, Inc., Developer for 30+ Years 14:55 Ballroom BC Session Panel: Rethinking Our Relationship with the Frontend Brian LeRoux, Brian Douglas, Laurie Voss, Alex Cole 16:10 Pacific DEKJ Session Frontend Enhance: SSR for Web Components Brian LeRoux Co-founder & CTO @Begin, created and maintains OpenJS Architect, maintains Enhance.dev