tRPC: Building type-safe APIs with TypeScript

tRPC: Building Type-Safe APIs with TypeScript

Jake Everhart Development Technologies, JavaScript, TypeScript Leave a Comment

Over the years, we’ve seen many approaches to HTTP API design. While REST APIs are still very popular throughout the industry, they offer no inherent guarantees that the client’s assumptions about the response structures will be valid.

GraphQL fills this gap to an extent by allowing client-side code greater control over the resulting structures but at the cost of added complexity. RPC (remote procedure call) frameworks attempt a different solution by sharing generated type definitions between the client and server implementations. What if there was a way to achieve the type safety of RPC by simply inferring the type definitions from the server’s code?

Enter tRPC. Since JavaScript (and specifically TypeScript) can already span across client and server implementations, tRPC allows a client to directly consume structures defined by the server’s exposed procedures. Essentially, you import your dependencies from the server to access these procedures, their return types are inferred and checked at build time, and your client code can confidently consume the returned data.

In this post, we’ll look at how it achieves these goals and what limitations it places on your project stack.

Apollo Client and GraphQL

Apollo Client: State Management for GraphQL Made Easy

Braden Niswonger Development Technologies, GraphQL, JavaScript, Programming, React Leave a Comment

In this post, we will explore Apollo Client integrated with a React application and how it provides an abstraction layer between a JavaScript application and a GraphQL server. The features Apollo Client offers make it a prime choice for devs also using GraphQL.

We’ll begin by discussing what Apollo Client is and how it can be advantageous over other state management libraries. And finally, we will look at some example React queries for retrieving and mutating data.

Let’s get started.

Spring Boot With GraphQL: What The Cool Kids Are Doing

Matt McCandless Development Technologies, GraphQL, Spring Boot 2 Comments

Attention: The following article was published over 4 years ago, and the information provided may be aged or outdated. Please keep that in mind as you read the post.This article is going to introduce you to Spring Boot with GraphQL. We’ll walk through a simple beer app to show you what it can do. So you have built this really …

GraphQL Presentation

[Video] Introduction to GraphQL

Keyhole Software Development Technologies, Educational Event, GraphQL, Video Leave a Comment

This 33-minute video features Keyhole Principle Consultant Mat Warger at our internal employee lunch and learn in November 2020. He discusses GraphQL’s main features and how it’s beneficial for use in modern APIs.

GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. Basically, it provides a better way to think about your data!

AWS Amplify GraphQL Queries with TypeScript and Hooks

Mat Warger AWS, Cloud, GraphQL, JavaScript, React, Tutorial, TypeScript Leave a Comment

I’m a big fan of Amplify. I’m also a big fan of TypeScript. Amplify is not built with TypeScript, and to use it effectively, sometimes you need to give it a little help, especially when it comes to GraphQL. With the advent of hooks, we can create some nice utilities for ourselves that let us leverage the power of TypeScript with our GraphQL queries. Let’s see what that looks like.

I’ll be assuming familiarity with React and TypeScript, i…

Originally posted by Mat Warger on mw.codes April 19, 2019.