/backend-trpc-api-boilerplate

⚒️ Minimal tRPC API boilerplate for separate BE-FE repositories. Easily publish fully typesafe APIs that any frontend can consume.

Primary LanguageTypeScriptMIT LicenseMIT

tRPC API Boilerplate Heisenberg

CI npm version

Minimal tRPC 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:

  • separation/encapsulation of backend and frontend domain (except what must be exposed to both through API).
  • separation of backend and frontend developers (larger teams/companies).
  • separation of backend and frontend 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 is released 📦
  • npm install trpc-api-boilerplate in any frontend app 🚀

Example Repo

Example frontend app repository - tRPC Frontend Boilerplate

Avoid publishing package?

If for whatever reason publishing a package is not an option:

  • privacy concerns
  • faster development iterations - skip CI
  • ...

Use:

  • Run npm run trpc-api-export and push code changes. In your frontend app run npm run trpc-api-import.
  • npm link