Install
trpcgo ships as a Go runtime package and a Go tool command.
Add The Runtime
Section titled “Add The Runtime”go get github.com/befabri/trpcgo@latestImport the runtime and HTTP protocol handler separately:
import ( "github.com/befabri/trpcgo" "github.com/befabri/trpcgo/trpc")Add The Generator
Section titled “Add The Generator”With Go 1.26+, add the generator as a tool in go.mod:
tool github.com/befabri/trpcgo/cmd/trpcgoThen run it with go tool:
mkdir -p web/gengo tool trpcgo generate -o web/gen/trpc.ts --zod web/gen/zod.ts ./...The CLI creates output files directly, so parent directories must already exist.
Frontend Packages
Section titled “Frontend Packages”Install the tRPC client packages used by your frontend framework. For a vanilla client:
npm install @trpc/client @trpc/serverFor React Query:
npm install @trpc/client @trpc/server @trpc/react-query @tanstack/react-queryFor the TanStack React Query helper API shown in Frontend Setup:
npm install @trpc/client @trpc/server @trpc/tanstack-react-query @tanstack/react-queryInstall Zod if you generate schemas:
npm install zodRequirements
Section titled “Requirements”- Go 1.26 or newer.
- tRPC v11 client packages.
- Zod 4 when using
--zodorWithZodOutput.
What trpcgo Does Not Install
Section titled “What trpcgo Does Not Install”trpcgo does not add CORS, authentication, persistence, or a web framework. The HTTP handler is plain net/http, so mount it behind Chi, Echo, Fiber adapters, standard middleware, or a raw http.ServeMux.