Repository navigation
tRPC-SvelteKit v4.1 brings first-class support for TanStack Svelte Query, fixes for the experimental WebSocket support, and LLM-friendly docs.
npm i trpc-sveltekit@4.1No breaking changes: upgrading from v4.0 is a matter of updating the package.
Highlights
- TanStack Svelte Query: the new
createTRPCQueryOptionsturns your tRPC client into typed query and mutation options and query keys, so you don't have to write query keys or query functions yourself. It coversqueryOptions,mutationOptions,queryKey,mutationKeyandpathKey, using the key format of tRPC's own TanStack Query integration, and depends on no TanStack Query package. See the Svelte Query guide and the new Svelte Query page in the simple example.const api = createTRPCQueryOptions(trpc(page)); const authors = createQuery(() => api.authors.list.queryOptions('smith'));
- WebSocket shutdown:
SvelteKitTRPCWSServerno longer keeps the process running afterSIGTERM/SIGINTwhile clients are connected. It now closes the connections (with code 1001, so clients reconnect) and letsadapter-nodeshut down gracefully. The newcloseWSSGlobalInstance()does the same for custom servers. - WebSocket connections: connections made before a router is attached (e.g. in development, before SvelteKit loads your hooks) are now refused, so clients retry instead of hanging. The docs also cover WebSocket authentication now.
- Bun:
@sveltejs/adapter-bunis verified to work, including streaming and subscriptions over server-sent events. - LLM-friendly docs:
llms.txtandllms-full.txtfor AI assistants and coding agents (how to use them). - Changelog: notable changes are now recorded in CHANGELOG.md.
See the changelog for the full list, including the docs website fixes.