https://github.com/mkosir/trpc-api-boilerplate
⚒️ Minimal tRPC API boilerplate for projects with separate BE-FE repositories. Easily publish fully typesafe APIs that any frontend can consume.
https://github.com/mkosir/trpc-api-boilerplate
trpc trpc-api trpc-server typescript
Last synced: about 2 months ago
JSON representation
⚒️ Minimal tRPC API boilerplate for projects with separate BE-FE repositories. Easily publish fully typesafe APIs that any frontend can consume.
- Host: GitHub
- URL: https://github.com/mkosir/trpc-api-boilerplate
- Owner: mkosir
- License: mit
- Created: 2023-06-08T07:58:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-02T08:28:03.000Z (3 months ago)
- Last Synced: 2025-07-02T09:31:32.959Z (3 months ago)
- Topics: trpc, trpc-api, trpc-server, typescript
- Language: TypeScript
- Homepage: https://trpc-api-boilerplate.onrender.com/
- Size: 1.12 MB
- Stars: 125
- Watchers: 3
- Forks: 23
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tRPC API Boilerplate 
[![CI][ci-badge]][ci-url]
Minimal [tRPC](https://trpc.io/) API boilerplate for projects with separate backend and frontend repositories. Easily publish fully typesafe APIs that any frontend can consume.
Monorepos are great, but sometimes the architecture requires separating the backend and frontend into distinct repositories.
### Why use this?
This boilerplate is ideal when you want to separate:
- **Domain/business logic** – expose only what needs to be exposed through the API.
- **Developer responsibilities** – for larger teams/companies.
- **CI/CD pipelines** – manage PRs, issues, and deployments independently.## Running
_Easily set up a local development environment_
- Fork & clone the repo
- Run `npm install`
- Make changes to the tRPC API
- Push - a new [package](https://www.npmjs.com/package/trpc-api-boilerplate) is released 📦 [![npm version][npm-badge]][npm-url]
- In your frontend app, install it `npm install trpc-api-boilerplate`## Example Repos
Example frontend app repositories:
- [tRPC Frontend Boilerplate](https://github.com/mkosir/trpc-fe-boilerplate-vite) - Vite
- [tRPC Frontend Boilerplate](https://github.com/mkosir/trpc-fe-boilerplate-next) - Next.js### Avoid publishing the package?
If for whatever reason publishing a package is not an option:
- privacy concerns
- faster development iterations - skip CI
- ...Use the repository to share types by running `npm run trpc-api-export` and push code changes.
In your [frontend app](https://github.com/mkosir/trpc-fe-boilerplate-vite/blob/main/package.json#L7), consume types by running `npm run trpc-api-import`.[ci-badge]: https://github.com/mkosir/trpc-api-boilerplate/actions/workflows/main.yml/badge.svg
[ci-url]: https://github.com/mkosir/trpc-api-boilerplate/actions/workflows/main.yml
[npm-url]: https://www.npmjs.com/package/trpc-api-boilerplate
[npm-badge]: https://img.shields.io/npm/v/trpc-api-boilerplate.svg