What problem does it solve?
Exposes a tRPC router on a plain Node HTTP or HTTP/2 server so teams can serve RPC procedures without bringing a full Express/Koa stack or relying on serverless/edge adapters, simplifying lightweight backend setups and local development.
Core Features & Use Cases
- Native HTTP mounting: Use createHTTPServer to listen with Node's built-in http server for minimal dependencies and predictable runtime behavior.
- Custom handler support: Use createHTTPHandler for custom http.createServer workflows such as health checks or mixed route handling.
- HTTP/2 & TLS: Serve over HTTP/2 with createHTTP2Handler and Node TLS certs for better performance and multiplexing.
- Routing helpers: Configure basePath to strip URL prefixes, integrate CORS middleware for cross-origin requests, and enforce maxBatchSize to control batched request limits.
- Use Case: Ideal for microservices, internal tools, or small APIs that require low-footprint servers with explicit control over routing, CORS, and TLS.
Quick Start
Create a minimal Node server that mounts a tRPC router on port 3000 with CORS enabled for http://localhost:5173 and a basePath of /trpc/.