trpcgo
Project description
trpcgo is a Go library implementing the tRPC protocol that brings end-to-end type safety to full-stack applications. Define your API types once in Go, and trpcgo automatically generates a fully-typed TypeScript AppRouter. The frontend uses standard @trpc/client and @trpc/react-query without any modification — the Go backend is fully transparent and interchangeable with a classic TypeScript tRPC backend.
Key Features
- Support for queries, mutations, and subscriptions (SSE streaming) with typed input/output.
- Automatic TypeScript type and Zod schema generation from Go code via static analysis and reflection.
- Global and per-procedure middleware, with composition through base procedures.
- CLI with watch mode for live regeneration during development, providing the same developer experience as TypeScript tRPC.
- No framework dependency, built on standard
net/http. - Input validation compatible with go-playground/validator.
- Error handling compliant with the tRPC protocol.
- Batch request support.
Developed with
Go: net/http, golang.org/x/tools, fsnotify
TypeScript: @trpc/client, @trpc/react-query, Zod