Steve Kinney

Full Stack TypeScript

The Repository for the Workshop

You can find all of the code that we’ll be playing with today in this repository.

When building modern TypeScript applications, you’ll quickly discover just how important it is to validate data effectively and maintain type safety from front to back. That’s where libraries like Zod, React Hook Form, and tRPC come to the rescue. You’ll learn how Zod transforms from a mere validation tool into a full-blown runtime guardian, sparing your code from sloppy user input. By pairing Zod with React Hook Form, you’ll see how typed schemas can both validate form data on the client and transfer seamlessly to the server for final checks.

On the server side, you’ll explore how Express can be carefully massaged into a type-safe environment using generic signatures like Request<Params, ResBody, ReqBody, ReqQuery> and by hooking up Zod (or alternative libraries) for runtime validation. You’ll also discover how to enforce consistent API responses, work with typed request headers, harness error-handling middleware, and keep your cookie usage under control. This ensures every route truly operates with the data shape you’ve promised—no more “surprise, that field is actually undefined.”

You’ll then see how to generate the holy grail of API docs—OpenAPI/Swagger specs—directly from your TypeScript code. Tools like zod-to-openapi help keep your documentation in perfect sync with your actual validation rules, turning the dreaded chore of “update the docs” into a speedy, automated step. If you want to dive even deeper into typed endpoints, you’ll learn that tRPC can eliminate the need for separate REST or GraphQL definitions, enabling type-checked procedure calls right in your frontend.

Throughout this journey, a big focus is placed on best practices: how to write advanced Zod schemas (unions, intersections, branded types, transforms) without losing your sanity, how to avoid repeated validations or enormous boilerplates, and how to keep performance from tanking. You’ll also uncover the secrets of testing: hooking up your Zod schemas to test frameworks, verifying your Express routes via supertest, and unit-testing your tRPC calls with zero fuss.

Finally, for those craving a full-stack approach, you’ll see how to tie these concepts into a database layer—be it Prisma or another TypeScript-friendly ORM. By unifying your type definitions from the database to the front end, you drastically reduce “API mismatch” headaches and keep development nimble. Overall, expect to walk away knowing how to craft robust apps that glean the best from TypeScript’s compile-time checks, while also guaranteeing real-world inputs won’t break your system at runtime.