Documentation
API

Overview

supastarter is designed to be a scalable and production-ready fullstack starter kit. One of the core features is a dedicated and extendable API layer. To enable this in a type-safe manner, we chose trpc as the API server and client library.

Why tRPC

tRPC is a modern RPC framework for TypeScript and gives you a way to define your API in a type-safe way. It also has a lot of features like caching, batching, authorization and more. It also has a wide range of extensions like tRPC OpenAPI which you can use to generate an OpenAPI endpoint for your API.

All API endpoints and it's resolvers are defined in the /packages/api/ library. In here you will find a modules folder which contains the different features modules of the API. Each module has it's own folder and is exporting all the different resolvers in an index.ts file.

For each module we then create a separate tRPC router in the /packages/api/trpc/router.ts file and aggregate all sub-routers into one main router.

The API is then exposed as a route handler that will be provided in a Next.js API route.

Learn more about the API in these different guides:

On this page

No Headings