Usage with edge runtimes
You can create a tRPC server within any edge runtime that follow the WinterCG, specifically the Minimum Common Web Platform API specification.
Some of these runtimes includes, but not limited to:
- Cloudflare Workers
- Deno Deploy
- Vercel Edge Runtime (& Next.js Edge Runtime)
How to use tRPC server with an edge runtime
tRPC provides a fetch adapter that uses the native Request
and Response
APIs as input and output. The tRPC-specific code is the same across all runtimes, the only difference being how the response is returned.
Follow the fetch adapter documentation to learn more.
Required Web APIs
tRPC server uses the following Fetch APIs:
Request
,Response
fetch
Headers
URL
If your runtime supports these APIs, you can use tRPC server.
tip
Fun fact: that also means you can use tRPC server in your browser!