Fullstack TypeScript, v2 (feat. Zod)

Steve Kinney
Temporal
4 hours, 8 minutes CC
Fullstack TypeScript, v2 (feat. Zod)

Course Description

Find the end-to-end type-safety strategy that works with your stack! Share TypeScript types between client and server applications. Take the guesswork out of API changes with Zod schemas, and every response is what you expect. Write tRPC on both the client and server for a smoother developer experience. Simplify database migrations with Prisma and generate your Zod schemas for air-tight type contracts between the database, server, and client.

This course and others like it are available as part of our Frontend Masters video subscription.

Preview
Close

Course Details

Published: May 19, 2025

Learning Paths

Learn Straight from the Experts Who Shape the Modern Web

Your Path to Senior Developer and Beyond
  • 200+ In-depth courses
  • 18 Learning Paths
  • Industry Leading Experts
  • Live Interactive Workshops

Table of Contents

Introduction

Section Duration: 9 minutes
  • Introduction
    Steve Kinney begins the course by sharing some of the challenges of end-to-end type safety. While both the frontend and backend applications might have strong type safety, a lot of trust is implied with the data sent between the two ends of the stack. This course will explore techniques for solving type safety issues across the full stack.

Zod Schema Validation

Section Duration: 1 hour, 9 minutes

API Type Safety

Section Duration: 1 hour, 13 minutes

API Contracts

Section Duration: 25 minutes

tRPC

Section Duration: 49 minutes
  • What is tRPC?
    Steve introduces tRPC, which allows developers to easily build & consume fully typesafe APIs without schemas or code generation. Full-stack projects using TypeScript can share types directly between client and server applications. Developers enjoy the ergonomics because the API endpoints resemble function calls.
  • tRPC on the Server
    Steve scaffolds the tRPC support for the server application. An adapter is created to initialize the router and add it as an Express middleware. A context module initializes the tRPC client and the tRPC procedures.
  • tRPC Queries
    Steve codes the initial tRPC query for retrieving tasks. The procedure initially includes the database queries. Later, the database queries are refactored into a TaskClient module that can be reused more easily.
  • tRPC Mutations
    Steve jumps to the completed code example for the TaskClient. tRPC mutations are added to the taskRouter to handle updating and deleting tasks. The tRPC server integration is completed by adding the `/api` endpoint to the Express application.
  • tRPC in the Client
    Steve refactors the client application to use the tRPC server endpoint. The code for the CRUD implementation is drastically reduced since the boilerplate fetch API is no longer required. Each API call reads like a function call and is type-safe.

Type-Safe Databases

Section Duration: 19 minutes

Wrapping Up

Section Duration: 2 minutes
  • Wrapping Up
    Steve wraps up the course by summarizing the pros and cons of full-stack type-safety across an application. While there isn't a one-size-fits-all approach to type safety, the abundance of tooling gives teams flexibility based on their stack, application environment, or unique constraints.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now