https://github.com/mkosir/trpc-api-boilerplate
⚒️ Minimal tRPC API boilerplate for 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: 7 months ago
JSON representation
⚒️ Minimal tRPC API boilerplate for 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 (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T13:56:38.000Z (over 1 year ago)
- Last Synced: 2024-03-06T15:06:30.866Z (over 1 year ago)
- Topics: trpc, trpc-api, trpc-server, typescript
- Language: TypeScript
- Homepage: https://trpc-api-boilerplate.onrender.com/
- Size: 1.01 MB
- Stars: 69
- Watchers: 4
- Forks: 17
- 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 separate BE-FE repositories. Easily publish fully typesafe APIs that any frontend can consume.
Monorepos are great, but sometimes we are targeting backend and frontend as separate (mono)repositories.
We might aim for backend and frontend repositories separation of:
- domain/business logic - expose only what need to be exposed through API.
- developers - larger teams/companies.
- CI/CD pipelines, PRs, issues, etc.... in that case checkout this boilerplate.
## Running
_Easily set up a local development environment_
- fork & clone repo
- `npm install`
- make changes to tRPC API & push - new [package](https://www.npmjs.com/package/trpc-api-boilerplate) is released 📦 [![npm version][npm-badge]][npm-url]
- install newly released package `npm install trpc-api-boilerplate` in any frontend app 🚀## Example Repo
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) - Nextjs### Avoid publishing package?
If for whatever reason publishing a package is not an option:
- privacy concerns
- faster development iterations - skip CI
- ...Use 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