Skip to content
/ trpc Public
forked from trpc/trpc

πŸ§™β€β™€οΈ End-to-end typesafe APIs made easy

License

Notifications You must be signed in to change notification settings

GertjanFi/trpc

Β 
Β 

Repository files navigation

tRPC

End-to-end typesafe APIs made easy

codecov

Server/client example The client above is not importing any code from the server, only it's type declarations.
Import type only imports declarations to be used for type annotations and declarations. It always gets fully erased, so there’s no remnant of it at runtime.

Intro

tRPC is a framework for building strongly typed RPC APIs with TypeScript. Alternatively, you can think of it as a way to avoid APIs altogether.

  • πŸ§™β€β™‚οΈΒ  Automatic typesafety & autocompletion inferred from your API-paths, their input data, outputs, & errors.
  • 🐎  Snappy DX. No code generation, run-time bloat, or build pipeline.
  • πŸƒΒ  Light. tRPC has zero deps and a tiny client-side footprint.
  • 🐻  Easy to add to your existing brownfield project.
  • πŸ”‹Β  Batteries included. React-library + Next.js/Express adapters. (But tRPC is not tied to React - reach out if you want to make a Svelte/Vue/... lib)
  • πŸ₯ƒΒ  Simple to use APIs for queries & mutations + experimental subscriptions support.
  • πŸ‘€Β  Quite a few examples in the ./examples-folder
  • βœ…Β  Well-tested & running in production.

tRPC requires TypeScript > 4.1 because of Template Literal Types, but you can get some benefits with autocompletion etc even if you use raw JS.


Usage

πŸ‘‰ See documentation on trpc.io. πŸ‘ˆ

Quick start:

npx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter trpc-prisma-starter

Example apps

Description URL Links
Next.js starter with Prisma, E2E testing, & ESLint

Quick start with create-next-app npx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter trpc-prisma-starter
n/a
Next.js TodoMVC-example with SSG & Prisma.

Quick start with create-next-app npx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-todomvc trpc-todo
todomvc.trpc.io
Vanilla standalone server & procedure calls with node.js n/a
Express server & procedure calls with node.js.
Uses experimental subscriptions.
n/a

Contributing / Development workflow

git clone [email protected]:trpc/trpc.git
cd trpc
yarn

Hacking around with it

In one terminal, will run preconstruct watch in parallel which builds all packages/* on change:

yarn dev

In another terminal, you can for instance navigate to examples/next-prisma-starter and run yarn dev & it will update whenever code is changed in the packages.

Testing

yarn test --watch

Testing is currently coalesced in ./packages/server/test - we import the different libs from here, this makes it easier for us to do integration testing + getting test coverage on the whole codebase.

codecov

Some things regarding subscriptions is excluded in the coverage as it's an experimental feature

Contributors ✨

Original 0.x-version was created by colinhacks and >1.x was created by KATT.


Alex Johansson

πŸ€” πŸ’» ⚠️ πŸ“– πŸ’‘ 🚧

Colin McDonnell

πŸ€” πŸ’» ⚠️ πŸ“–

Pieter Venter

πŸ€” πŸ‘€

Kalle

πŸ›

Malte Granderath

πŸ›

KristΓ³f PoduszlΓ³

πŸ€” πŸ›

Rich Haines

πŸ’‘

Simon Edelmann

πŸ’» πŸ€” ⚠️ πŸ“–

Anthony Short

πŸ’΅

Hampus Kraft

πŸ’΅

Powered by Vercel

About

πŸ§™β€β™€οΈ End-to-end typesafe APIs made easy

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 94.3%
  • JavaScript 4.3%
  • CSS 1.4%