Building Typesafe APIs with tRPC & TypeScript

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:

What is the focus of your work these days?

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.

What's the motivation behind your talk?

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.

What is the target audience?

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.

What are the main takeaways from your session?

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. 


Speaker

Brian Douglas

Co-founder & CEO @saucedopen, previously led Developer Advocacy by showcasing newest features @Github

Brian Douglas is the founder and CEO of Open Sauced where he works on increasing the knowledge and insights of open-source communities. In the past he’s lead Developer Advocacy at GitHub by fostering a community of early adopters through content creation showcasing the newest Github features.

Brian has a passion for open-source and loves mentoring new contributors through Open Sauced, the platform that empowers the best developers to work in open-source.

 

Read more

Date

Wednesday Oct 26 / 11:50AM PDT ( 50 minutes )

Location

Pacific DEKJ

Topics

Frontend Application Programming Interface TypeScript REST gRPC GraphQL Languages

Share

From the same track

Session Frontend

Everyone Can Be a Full-Stack Engineer

Wednesday Oct 26 / 10:35AM PDT

Serverless infrastructure makes it easier than ever to eliminate the boundary between frontend and backend. When engineers own the entire stack, they can focus less on rebuilding the same infrastructure and more on what matters: the user experience.

Speaker image - Alex Cole

Alex Cole

Software Engineer @convex_dev, previously @Asana

Session Frontend

Enhance: SSR for Web Components

Wednesday Oct 26 / 04:10PM PDT

Building web apps is often characterized as painful, complex, and time consuming. There are many tools, libraries, frontend frameworks, and opinions about how to fix that problem… but they come with a catch. The frontend ecosystem is fractured into incompatible niches.

Speaker image - Brian LeRoux

Brian LeRoux

Co-founder & CTO @Begin, created and maintains OpenJS Architect, maintains Enhance.dev

Session

Panel: Rethinking Our Relationship with the Frontend

Wednesday Oct 26 / 02:55PM PDT

Each of the track speakers joins together in a panel about how the front-end is changing in today’s high velocity, domain-focused teams.

Speaker image - Brian LeRoux

Brian LeRoux

Co-founder & CTO @Begin, created and maintains OpenJS Architect, maintains Enhance.dev

Speaker image - Brian Douglas

Brian Douglas

Co-founder & CEO @saucedopen, previously led Developer Advocacy by showcasing newest features @Github

Speaker image - Laurie Voss

Laurie Voss

Data Analyst @Netlify

Speaker image - Alex Cole

Alex Cole

Software Engineer @convex_dev, previously @Asana

Session

What the Data Says: Emerging Technical Trends in Front-End and How They Affect You

Wednesday Oct 26 / 01:40PM PDT

Over the last 30 years of web development a predictable cycle has appeared in the adoption, commoditization and eventual abstraction of major new technical trends in web development.

Speaker image - Laurie Voss

Laurie Voss

Data Analyst @Netlify