finds.dev← search

// the find

icflorescu/trpc-sveltekit

★ 839 · TypeScript · ISC · updated Mar 2025

End-to-end typesafe APIs with tRPC.io for your SvelteKit applications.

A thin adapter that wires tRPC v10 into SvelteKit's server hooks, giving you end-to-end type safety between your SvelteKit backend and client pages. It's for SvelteKit developers who want tRPC's type inference without building the glue themselves. The package is small — essentially `createTRPCHandle` for HTTP and an experimental WebSocket layer on top.

The HTTP integration is clean: one `createTRPCHandle` call in `hooks.server.ts` and you're done, with no custom API routes to manage. The client helper pattern (singleton browser client, new instance per SSR request) correctly handles the SvelteKit server/client split that trips people up. There are three working examples covering simple, auth-with-Prisma, and WebSocket cases — not toy snippets, actual runnable apps. The WebSocket support routes around SvelteKit's missing native WS support by attaching to the Vite dev server's upgrade event, which is clever given the constraint.

Last push was March 2025 and the repo is effectively in maintenance mode — SvelteKit moves fast and adapter-auto support is missing, which means Cloudflare Workers and other edge targets are unsupported. The WebSocket implementation routes all tRPC calls over the socket, not just subscriptions, which is wasteful and explicitly called out as a known issue with no fix timeline. No support for tRPC v11, which shipped with meaningful breaking changes to the client API. The `globalThis` symbol trick for sharing the WS server between Vite and SvelteKit is fragile — it works until something in the Vite lifecycle changes.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →