Compatibility
trpcgo requires Go 1.26 or newer.
The project uses modern Go features including generics, tool directives, and errors.AsType.
tRPC Client
Section titled “tRPC Client”Generated router types target tRPC v11 client packages.
The generated AppRouter type imports from @trpc/server, which should be installed in the frontend package alongside @trpc/client.
Generated schemas target Zod 4.
Use --zod-mini or WithZodMini(true) to generate zod/mini functional syntax instead of standard chained syntax.
The runtime is plain net/http. No web framework is required.
You can mount trpc.NewHandler(router, basePath) behind any router or middleware stack that can serve an http.Handler.
trpcgo does not implement CORS. Add CORS in your web framework, HTTP middleware, reverse proxy, or edge layer.
Serialization
Section titled “Serialization”trpcgo uses JSON over the tRPC HTTP protocol.
Notable mappings:
time.Timeis represented as a string in TypeScript.[]byteis represented as a string.json.RawMessage,any, andinterface{}becomeunknown.int64anduint64generate number-based Zod schemas because JSON sends numbers, not JavaScriptbigintvalues.
Example App
Section titled “Example App”examples/start-trpc/ contains a complete Go server and TanStack Start frontend showing:
- Queries, mutations, void procedures, and SSE subscriptions.
- Generated
AppRouter,RouterInputs, andRouterOutputs. - Generated Zod schemas used for form validation.
- Middleware, metadata, custom error formatting, and server-side
Call.