trpc / Trpc
Programming Languages
Projects that are alternatives of or similar to Trpc
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 type-safety & 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-hello-world my-app
Example apps
URL | Command | Path | Description |
---|---|---|---|
todomvc.trpc.io | yarn example:todomvc |
./examples/next-prisma-todomvc |
TodoMVC-example with SSG & Prisma. Playwright for E2E-testing |
chat.trpc.io | yarn example:chat |
./examples/next-ssg-chat |
Next.js real-time chat example with SSG & Prisma. Playwright for E2E-testing |
hello-world.trpc.io | yarn example:hello |
./examples/next-hello-world |
Minimal Next.js example. Playwright for E2E-testing |
n/a | yarn example:standalone |
./examples/standalone-server |
Standalone tRPC server + node client |
n/a | yarn example:playground |
./examples/playground |
Express server + node client |
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-hello-world
and run yarn dev
& it will update whenever code is changed in the packages.
Testing
cd packages/server
yarn test --watch
Some things regarding subscriptions is excluded in the coverage as it's an experimental feature
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.
Contributors ✨
Original 0.x
-version was created by colinhacks and >1.x
was created by KATT.
Alex Johansson 🤔 💻 ⚠️ 📖 💡 🚧 |
Colin McDonnell 🤔 💻 ⚠️ 📖 |
Pieter Venter 🤔 👀 |