/vanilla-typesafe-apis

A pragmatic approach for typesafe APIs using nothing but vanilla TypeScript

Primary LanguageTypeScript

Type-safe APIs using vanilla TypeScript

This is not a library or framework. It is rather a simple solution to implement fullstack type-safe APIs without external dependencies.

End-to-end type-safe APIs without dependencies or ecosystem buy-in. Just your REST APIs, some TypeScript, and a happy developer.

We only want effortless, type-safe APIs all the way down the stack.

typesafe_apis_video.mp4

The concept is very simple: TypeScript API controllers that expose all needed typing information and runtime type safety thanks to standard JSON Schemas.

Key Features

  • Type-Safe REST APIs: Leverage TypeScript for both compile-time and runtime type safety without additional libraries.
  • Zero Dependencies: Implement type safety using native TypeScript features and JSON Schemas.
  • Seamless Developer Experience: Enjoy the benefits of type-safe APIs without the overhead of adopting a new framework or library.

Getting Started

To explore the concepts and implementations detailed in this repository, check out the following resources:

  • Detailed Explanation: For a deep dive into the motivations, concepts, and step-by-step implementation guide, read my comprehensive blog post: You don't need GraphQL or tRPC.
  • Interactive Example: Experiment with the live code and see the type-safe APIs in action on CodeSandbox: Edit scriptify/vanilla-typesafe-apis/main.