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

Overview

tRPC-SvelteKit

✨ tRPC-SvelteKit

NPM version License Downloads

End-to-end typesafe APIs with tRPC.io in SvelteKit applications.
No code generation, run-time bloat, or build pipeline.

❀️ πŸ‡ΊπŸ‡¦

See below.

Key features

βœ… Works with @sveltejs/adapter-node & @sveltejs/adapter-vercel
βœ… Works with SvelteKit's load() function for SSR

Example application with Prisma & superjson

πŸ‘‰ tRPC-Sveltekit-Example

TL;DR

Add this in your SvelteKit app hooks:

// src/hooks.ts
import { createTRPCHandle } from 'trpc-sveltekit';
// create your tRPC router...

export const handle = createTRPCHandle({ url: '/trpc', router }); // πŸ‘ˆ add this handle

How to use

  1. Install this package

npm install trpc-sveltekit/yarn add trpc-sveltekit

  1. Create your tRPC routes, context and type exports:
// $lib/trpcServer.ts
import type { inferAsyncReturnType } from '@trpc/server';
import * as trpc from '@trpc/server';

// optional
export const createContext = () => {
  // ...
  return {
    /** context data */
  };
};

// optional
export const responseMeta = () => {
  // ...
  return {
    // { headers: ... }
  };
};

export const router = trpc
  .router<inferAsyncReturnType<typeof createContext>>()
  // queries and mutations...
  .query('hello', {
    resolve: () => 'world',
  });

export type Router = typeof router;
  1. Add this handle to your application hooks (src/hooks.ts or src/hooks/index.ts):
// src/hooks.ts or src/hooks/index.ts
import { createContext, responseMeta, router } from '$lib/trpcServer';
import { createTRPCHandle } from 'trpc-sveltekit';

export const handle = createTRPCHandle({
  url: '/trpc', // optional; defaults to '/trpc'
  router,
  createContext, // optional
  responseMeta, // optional
});

Learn more about SvelteKit hooks here.

  1. Create a tRPC client:
// $lib/trpcClient.ts
import type { Router } from '$lib/trpcServer'; // πŸ‘ˆ only the types are imported from the server
import * as trpc from '@trpc/client';

export default trpc.createTRPCClient<Router>({ url: '/trpc' });
  1. Use the client like so:
// page.svelte
import trpcClient from '$lib/trpcClient';

const greeting = await trpcClient.query('hello');
console.log(greeting); // => πŸ‘ˆ world

Recipes & caveats πŸ› 

Usage with Prisma

When you're building your SvelteKit app for production, you must instantiate your Prisma client like this: βœ”οΈ

// $lib/prismaClient.ts
import pkg from '@prisma/client';
const { PrismaClient } = pkg;

const prismaClient = new PrismaClient();
export default prismaClient;

This will not work: ❌

// $lib/prismaClient.ts
import { PrismaClient } from '@prisma/client';

const prismaClient = new PrismaClient();
export default prismaClient;

Configure superjson to correctly handle Decimal.js / Prisma.Decimal

❓ If you don't know why you'd want to use superjson, learn more about tRPC data transformers here.

By default, superjson only supports built-in data types to keep the bundle-size as small as possible. Here's how you could extend it with Decimal.js / Prisma.Decimal support:

// $lib/trpcTransformer.ts
import Decimal from 'decimal.js';
import superjson from 'superjson';

superjson.registerCustom<Decimal, string>(
  {
    isApplicable: (v): v is Decimal => Decimal.isDecimal(v),
    serialize: (v) => v.toJSON(),
    deserialize: (v) => new Decimal(v),
  },
  'decimal.js'
);

export default superjson;

Then, configure your tRPC router like so:

// $lib/trpcServer.ts
import trpcTransformer from '$lib/trcpTransformer';
import * as trpc from '@trpc/server';

export const router = trpc
  .router()
  // .merge, .query, .mutation, etc.
  .transformer(trpcTransformer); // πŸ‘ˆ

export type Router = typeof router;

...and don't forget to configure your tRPC client:

// $lib/trpcClient.ts
import type { Router } from '$lib/trpcServer';
import transformer from '$lib/trpcTransformer';
import * as trpc from '@trpc/client';

export default trpc.createTRPCClient<Router>({
  url: '/trpc',
  transformer, // πŸ‘ˆ
});

⚠️ You'll also have to use this custom svelte.config.js in order to be able to build your application for production with adapter-node/adapter-vercel:

// svelte.config.js
import adapter from '@sveltejs/adapter-node'; // or Vercel 
import preprocess from 'svelte-preprocess';

/** @type {import('@sveltejs/kit').Config} */
const config = {
  preprocess: preprocess(),

  kit: {
    adapter: adapter(),
    vite:
      process.env.NODE_ENV === 'production'
        ? {
            ssr: {
              noExternal: ['superjson'],
            },
          }
        : undefined,
  },
};

export default config;

Client-side helper types

It is often useful to wrap the functionality of your @trpc/client api within other functions. For this purpose, it's necessary to be able to infer input types, output types, and api paths generated by your @trpc/server router. Using tRPC's inference helpers, you could do something like:

// $lib/trpcClient.ts
import type { Router } from '$lib/trpcServer';
import trpcTransformer from '$lib/trpcTransformer';
import * as trpc from '@trpc/client';
import type { inferProcedureInput, inferProcedureOutput } from '@trpc/server';

export default trpc.createTRPCClient<Router>({
  url: '/trpc',
  transformer: trpcTransformer,
});

type Query = keyof Router['_def']['queries'];
type Mutation = keyof Router['_def']['mutations'];

// Useful types πŸ‘‡πŸ‘‡πŸ‘‡
export type InferQueryOutput<RouteKey extends Query> = inferProcedureOutput<Router['_def']['queries'][RouteKey]>;
export type InferQueryInput<RouteKey extends Query> = inferProcedureInput<Router['_def']['queries'][RouteKey]>;
export type InferMutationOutput<RouteKey extends Mutation> = inferProcedureOutput<
  Router['_def']['mutations'][RouteKey]
>;
export type InferMutationInput<RouteKey extends Mutation> = inferProcedureInput<Router['_def']['mutations'][RouteKey]>;

Then, you could use the inferred types like so:

let authors: InferQueryOutput<'authors:browse'> = []; const loadAuthors = async () => { authors = await trpc.query('authors:browse', { genre: 'fantasy' }); }; ">
// authors.svelte
<script lang="ts">
  let authors: InferQueryOutput<'authors:browse'> = [];

  const loadAuthors = async () => {
    authors = await trpc.query('authors:browse', { genre: 'fantasy' });
  };
</script>

Server-Side Rendering

If you need to use the tRPC client in SvelteKit's load() function for SSR, make sure to initialize it like so:

// $lib/trpcClient.ts
import { browser } from '$app/env';
import type { Router } from '$lib/trpcServer';
import * as trpc from '@trpc/client';

const client = trpc.createTRPCClient<Router>({
  url: browser ? '/trpc' : 'http://localhost:3000/trpc', // πŸ‘ˆ
});

Vercel's Edge Cache for Serverless Functions

Your server responses must satisfy some criteria in order for them to be cached Verced Edge Network, and here's where tRPC's responseMeta() comes in handy. You could initialize your handle in src/hooks.ts like so:

// src/hooks.ts or src/hooks/index.ts
import { router } from '$lib/trpcServer';
import { createTRPCHandle } from 'trpc-sveltekit';

export const handle = createTRPCHandle({
  url: '/trpc',
  router,
  responseMeta({ type, errors }) {
    if (type === 'query' && errors.length === 0) {
      const ONE_DAY_IN_SECONDS = 60 * 60 * 24;
      return {
        headers: {
          'cache-control': `s-maxage=1, stale-while-revalidate=${ONE_DAY_IN_SECONDS}`
        }
      };
    }
    return {};
  }
});

Example

See an example with Prisma & superjson: ✨

Stand with Ukraine

On 24th of February 2022 Russia unlawfully invaded Ukraine. This is an unjustified, unprovoked attack on the sovereignty of a neighboring country, but also an open affront to international peace and stability that has the potential to degenerate into a nuclear event threatening the very existence of humanity. I am an EU (Romanian) citizen, but I am doing everything in my power to stop this madness. I stand with Ukraine. The entire Svelte community ❀️ πŸ‡ΊπŸ‡¦ . Here's how you can show your support.

License

The ISC License.

Comments
  • Update for newest version of tRPC (v10)

    Update for newest version of tRPC (v10)

    resolveHTTPResponse has been moved to @trpc/server/http. Also, the way of defining a router has changed in v10, I updated that in the README and tests.

    opened by sproott 7
  • Is it possible to use trpc and benefit from edge caching at the same time?

    Is it possible to use trpc and benefit from edge caching at the same time?

    First off, thank you for this package!

    So my current stack is Sveltekit, Prisma, Planetscale & Typescript. I've never used trpc before but I'm interested in learning how to use since it seems(?) like a natural fit that can provide better type safety. At the same time, it would be great to take advantage of edge caching from providers such as Vercel or Cloudflare.

    Would that be possible? The reason I ask is because the docs mention that this package requires the use of @sveltejs/node-adapter, as opposed to the vercel or cloudflare adapter.

    Because I've never used trpc before, the answer to my previous question might be extremely obvious or outright impossible. Even if it requires changing the structure of my app (splitting it into multiple parts, etc), I'd be grateful for any suggestions/advice.

    Ultimately, I'm trying to figure out if it's a good idea to go down this rabbithole.

    good first issue question 
    opened by ambiguous48 5
  • How to use createTRPCHandle with custom / local handle logic?

    How to use createTRPCHandle with custom / local handle logic?

    The examples have createTRPCHandle completely taking over the svelte server handle hook. How would we got about mixing our own custom logic in the handle hook? I believe in 2.x we would do something similar to what's described in this pull request. I realize quite a bit has been refactored with the latest 3.x version and that example doesn't work anymore, so looking for an alternative / updated approach?

    documentation enhancement 
    opened by caschbre 4
  • Custom hooks for `svelte-query`

    Custom hooks for `svelte-query`

    I have been doodling around with some custom tRPC hooks and I have arrived upon a sort of solution to use this in conjunction with svelte-query. This does address #22, but I feel that its not quite relevant enough as this solution is written to work with tRPC v10 and is meant to be a potential solution to use in the future. Personally, I feel that the Discussions tab would be a more fitting place for something like this. This solution uses the sproot/trpc-sveltekit fork, which is updated to use tRPC v10.

    Anyway, here's the code I came up with:

    // $lib/client/queryHooks.ts
    import trpc from '$lib/client/trpc';
    import type { AppRouter } from '$lib/server/trpcServer';
    import {
    	useMutation,
    	useQuery,
    	type QueryKey,
    	type UseMutationOptions,
    	type UseQueryOptions,
    } from '@sveltestack/svelte-query';
    import type { TRPCClientError } from '@trpc/client';
    import type {
    	AnyMutationProcedure,
    	AnyQueryProcedure,
    	inferRouterInputs,
    	inferRouterOutputs,
    	ProcedureOptions,
    } from '@trpc/server';
    
    const trpcClient = trpc();
    
    type RouterError = TRPCClientError<AppRouter>;
    
    type RouterQuery<T = AppRouter['_def']['procedures']> = {
    	[K in keyof T]: T[K] extends AnyQueryProcedure ? K : never;
    }[keyof T];
    type RouterMutation<T = AppRouter['_def']['procedures']> = {
    	[K in keyof T]: T[K] extends AnyMutationProcedure ? K : never;
    }[keyof T];
    
    type RouterInput = inferRouterInputs<AppRouter>;
    type RouterOutput = inferRouterOutputs<AppRouter>;
    
    export const queryHook = async <TQuery extends RouterQuery>(
    	key: TQuery,
    	input: RouterInput[TQuery],
    	opts?: ProcedureOptions,
    ) => {
    	const queryFunction = trpcClient[key].query as (
    		input: RouterInput[TQuery],
    		opts?: ProcedureOptions
    	) => unknown;
    	return (await queryFunction(input, opts)) as RouterOutput[TQuery];
    };
    
    export const mutateHook = async <TQuery extends RouterMutation>(
    	key: TQuery,
    	input: RouterInput[TQuery],
    	opts?: ProcedureOptions,
    ) => {
    	const queryFunction = trpcClient[key].mutate as (
    		input: RouterInput[TQuery],
    		opts?: ProcedureOptions
    	) => unknown;
    	return (await queryFunction(input, opts)) as RouterOutput[TQuery];
    };
    
    export const useTRPCQuery = <TQuery extends RouterQuery>(
    	key: TQuery,
    	input: RouterInput[TQuery],
    	opts?: UseQueryOptions<RouterOutput[TQuery], RouterError, RouterOutput[TQuery], QueryKey>,
    ) => {
    	return useQuery<RouterOutput[TQuery], RouterError>(key, () => queryHook(key, input), opts);
    };
    
    export const useTRPCMutation = <TMutation extends RouterMutation>(
    	key: TMutation,
    	input: RouterInput[TMutation],
    	opts?: UseMutationOptions<RouterOutput[TMutation], RouterError, void, unknown>,
    ) => {
    	return useMutation<RouterOutput[TMutation], RouterError>(key, () => mutateHook(key, input), opts);
    };
    

    This is super hacky, but it does provide the proper type definitions for both inputs and outputs. I'm still fairly new to Typescript and still learning, so I would really appreciate any feedback regarding how this could be improved.

    Usage:

    <script lang="ts">
    import { useTRPCMutation, useTRPCQuery } from '$lib/client/queryHooks';
    
    const userQuery = useTRPCQuery('getUser', 1);
    const userMutation = useTRPCMutation('updateUser', { id: 1, name: 'foo' });
    </script>
    

    Do let me know if this issue does not belong here so that I can remove it.

    opened by vishalbalaji 4
  • Some outdated info

    Some outdated info

    Let me preface this by saying that I have never used tRPC before and I hope none of this comes from my incompetence. I was really happy to find some resources on using tRPC with sveltekit, although it's a bit of a bumpy ride for now.

    Describe the bug The Readme contains some information that is outdated or more generally doesn't reflect best practices as indicated by tRPC and sveltekit.

    To Reproduce Try to use the instructions in a fresh sveltekit project

    Expected behavior No warnings should appear

    Additional context First off, trpc has released or is close to release their v10 apparently, and I had to use v9 instead.

    When using the provided code for the trpcServer, the following warning appears: image

    It seems the recommended approach uses initTRPC to construct the router.

    Likewise, when creating the client, the recommended approach uses createTRPCProxyClient and httpBatchLink.

    In the Readme, the method recommended to use trpc in the load function for SSR uses the outdated $app/env import and doesn't take into account that the dev port is not fixed anymore. Also, the example doesn't show how to use this with createTRPCProxyClient.

    For the inference helpers, the tRPC docs also show another method using inferRouterInputs.

    I would love a revamp of the Readme that takes into account the latest changes of sveltekit and tRPC. Thanks!

    bug 
    opened by beeb 4
  • Update to tRPC v10

    Update to tRPC v10

    Any plans to update this adapter to use tRPC v10?

    • Announcement post: https://trpc.io/blog/announcing-trpc-10
    • Migration guide: https://trpc.io/docs/migrate-from-v9-to-v10
    enhancement 
    opened by doceazedo 3
  • ERR_MODULE_NOT_FOUND with latest version

    ERR_MODULE_NOT_FOUND with latest version

    Describe the bug trpc-sveltekit cannot be imported

    To Reproduce Steps to reproduce the behavior:

    1. copy bookstall folder from examples somewhere in your filesystem (e.g., into /tmp/, so that it does not have the package source in one of the parent directories)
    2. cd in to the bookstall folder you just copied and run npm install
    3. run npm run dev
    4. open browser to see the error

    Expected behavior the example should work without errors

    Full Error

    Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/tmp/bookstall/node_modules/trpc-sveltekit/dist/client' imported from /tmp/bookstall/node_modules/trpc-sveltekit/dist/index.js
        at new NodeError (node:internal/errors:372:5)
        at finalizeResolution (node:internal/modules/esm/resolve:405:11)
        at moduleResolve (node:internal/modules/esm/resolve:964:10)
        at defaultResolve (node:internal/modules/esm/resolve:1173:11)
        at ESMLoader.resolve (node:internal/modules/esm/loader:604:30)
        at ESMLoader.getModuleJob (node:internal/modules/esm/loader:318:18)
        at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
        at link (node:internal/modules/esm/module_job:78:36)
    

    Desktop:

    • OS: Ubuntu 22.04.1
    • Browser: Chorme
    • Version 107.0.5304.110

    Additional context The same problem arises when installing trpc-sveltekit from npm in any other project. Interestingly, copying the package folder containing the source of the trpc-sveltekit package in the root of the project and installing it with npm install package/ fixes the issue.

    bug 
    opened by spbaecchi 2
  • Websocket :)

    Websocket :)

    Hey awasome work, Could you give a shot at adding websockets to this project.

    I gave it a shot

    import { browser } from '$app/env';
    import type { Router } from '$lib/server/trpc';
    import * as trpc from '@trpc/client';
    import type { inferProcedureInput, inferProcedureOutput } from '@trpc/server';
    import trpcTransformer from 'trpc-transformer';
    import { httpLink } from '@trpc/client/links/httpLink';
    import { wsLink, createWSClient } from '@trpc/client/links/wsLink';
    import { splitLink } from '@trpc/client/links/splitLink';
    
    const url = browser ? '/trpc' : 'http://localhost:3000/trpc';
    
    const httpUrl = 'http://localhost:3000/trpc';
    const wsUrl = 'ws://localhost:3000/trpc';
    
    export default (loadFetch?: typeof fetch) => {
      try {
        trpc.createTRPCClient<Router>({
          transformer: trpcTransformer,
          links: [
            splitLink({
              condition: (op) => {
                return op.type === 'subscription';
              },
              true: wsLink({
                client: createWSClient({
                  url: wsUrl
                })
              }),
              false: httpLink({
                url: httpUrl
              })
            })
          ]
        });
      } catch {
        return trpc.createTRPCClient<Router>({
          url: '/trpc',
          transformer: trpcTransformer,
          fetch: loadFetch
        });
      }
    };
    
    type Query = keyof Router['_def']['queries'];
    type Mutation = keyof Router['_def']['mutations'];
    
    export type InferQueryOutput<RouteKey extends Query> = inferProcedureOutput<
      Router['_def']['queries'][RouteKey]
    >;
    export type InferQueryInput<RouteKey extends Query> = inferProcedureInput<
      Router['_def']['queries'][RouteKey]
    >;
    export type InferMutationOutput<RouteKey extends Mutation> = inferProcedureOutput<
      Router['_def']['mutations'][RouteKey]
    >;
    export type InferMutationInput<RouteKey extends Mutation> = inferProcedureInput<
      Router['_def']['mutations'][RouteKey]
    >;
    

    just don't know how to pull i the WS server into svelte

    opened by lantos-lgtm 2
  • Wrong type of `fetch`

    Wrong type of `fetch`

    I tried to follow the docs to get tRPC to work in SSR. I got a type error though.

    The fetch function passed to SvelteKit's load has a signature like this: (info: RequestInfo, init?: RequestInit): Promise<Response>, but Node's fetch function's first argument has a broader type: RequestInfo | URL. That gives a type mismatch when passing the fetch function to the custom trpcClient function:

    image

    I had to do a typecast in the trpcClient function to get the types to match:

    image

    Any idea why the types are different? Perhaps something changed in a newer version of SvelteKit?

    opened by sproott 2
  • Custom typings or type definition

    Custom typings or type definition

    Hi! I'm finding that in both my first and second project I've had issues with transfering Date type over the trpc. Is there a way to define the type to be Date rather the string?

    (Apologies for the autolabel)

    bug 
    opened by Indeedornot 1
  • Route not found after deploying to another environment

    Route not found after deploying to another environment

    I recently added trpc-sveltekit to an existing project. After building the project, everything appears to work well locally (of course! lol)... however after deploying to a test environment, I start to see this error in the logs.

    2022-12-07 22:33 +00:00: Error: Not found: /files.create
    2022-12-07 22:33 +00:00:     at resolve (file:///local.path/build/server/index.js:2738:18)
    2022-12-07 22:33 +00:00:     at resolve (file:///local.path/build/server/index.js:2761:34)
    2022-12-07 22:33 +00:00:     at file:///local.path/node_modules/trpc-sveltekit/dist/server.js:29:16
    2022-12-07 22:33 +00:00:     at Object.handle (file:///local.path/build/server/chunks/hooks.server-55dce63f.js:5110:26)
    2022-12-07 22:33 +00:00:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
    2022-12-07 22:33 +00:00:     at async respond (file:///local.path/build/server/index.js:2759:22)
    2022-12-07 22:33 +00:00:     at async Array.ssr (file:///local.path/build/handler.js:16060:3)
    

    I see the browser attempting to make the request, which returns a 404. https://testing.site/trpc/files.create?batch=1

    This doesn't appear to be an issue of it working in dev mode but not after a build since I can run the build locally just fine. Most likely an environment configuration issue... maybe something is locked down tighter on the test environment, etc. But when it comes to tRPC, I'm not sure what to look for.

    opened by caschbre 1
Owner
Ionut-Cristian Florescu
β€οΈπŸ‡ΊπŸ‡¦ Building web and mobile apps and sometimes writing about technology and its impact on human behaviour. React, Next.js & Node.js geek. Owner of swapp.ro.
Ionut-Cristian Florescu
Quick T3 Stack with SvelteKit for rapid deployment of highly performant typesafe web apps.

create-t3svelte-app Just Build npx create-t3svelte-app Outline Get Building npm yarn More Info ?? Early Version Note Prisma Requirements Available Tem

Zach 85 Dec 26, 2022
Scaffold a full-stack SvelteKit application with tRPC and WindiCSS out of the box

create-sweet-app Interactive CLI to quickly set up an opinionated, full-stack, typesafe SvelteKit project. Inspired by the T3 Stack and create-t3-app

David HrabΔ› 10 Dec 16, 2022
TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy

Atlas SDK atlas_sdk is a TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy Links Docs Import Replace LATEST_VERSION with current latest versi

Erfan Safari 20 Dec 26, 2022
typesafe nodejs client for transit.land

TransitLand Graphql Client About Since the Transitland released its new and shiny GraphQL API, it is possible to query the API using GraphQL. The clie

ioki 5 Jan 9, 2023
Typesafe API for processing iterable data in TypeScript and JavaScript.

Stream API Type-safe API for processing iterable data in TypeScript and JavaScript similarly to Java 8 Stream API, LINQ or Kotlin Sequences. Unlike Rx

Norbert Szilagyi 31 Aug 4, 2022
End-to-End type safety for REST APIs written in Fastify. Only problem is you have to explicity export and register route handlers. LOL

Chino intelligence in japaneese End-to-End type safety for REST APIs written in Fastify. Only problem is you have to explicity export and register rou

sambit sahoo 2 Sep 12, 2022
Perfect SvelteKit dark mode in 2 lines of code. Support System preference and any other theme with no flashing

This library is a port of next-theme for SvelteKit. All credit goes to pacocoursey and all next-themes contributors While usable, this library is stil

null 42 Sep 30, 2022
This is a blog built with sveltekit, tailwind and daisyUI, made to be used as my personal blog.

svelte-blogger This is a blog built with sveltekit, tailwind and daisyUI, made to be used as my personal blog. This app also use graphql and use markd

lipe 6 Jun 23, 2022
Sveltekit + Tauri Template

Skitty Template for building SvelteKit + Tauri (Skitty) Warning This project is supposed to be used temporary only (until svelte-add tauri has finishe

null 6 Jul 25, 2022
Documentation integration for SvelteKit.

KitDocs Documentation integration for SvelteKit. You can think of it as a VitePress alternative for Svelte. ✨ Features ?? Vite plugin for transforming

Svelteness 244 Dec 28, 2022
Prisma 2+ generator to emit fully implemented tRPC routers

Prisma tRPC Generator Automatically generate fully implemented tRPC routers from your Prisma Schema. This includes routers, app router and of course a

Omar Dulaimi 370 Jan 3, 2023
A set of tools, helping you building efficient apps in a fast way. >> SvelteKit & GraphQL <<

KitQL KitQL, A set of tools, helping you building efficient apps in a fast way. ?? Infos Documentation: https://kitql.vercel.app/ Day by day progress,

JYC 262 Dec 27, 2022
Simple starter for SvelteKit with Tailwind CSS already set up and ready to go.

Get Started Simple Sveltekit boilerplate with Tailwind CSS already set up. Just run npm install to download the dependencies. Info I use Tailwind in p

Jordan 16 Dec 23, 2022
tRPC-ified SWR hooks

trpc-swr tRPC-ified SWR hooks Installation npm install trpc-swr @trpc/client Usage First, create your fully typed hooks using your router type: // trp

Sachin Raja 129 Jan 8, 2023
Prisma +2 generator to emit a tRPC shield from your Prisma schema

Prisma tRPC Shield Generator Automatically generate a tRPC Shield from your Prisma Schema. Updates every time npx prisma generate runs. Table of Conte

Omar Dulaimi 27 Dec 24, 2022
Proof of concept: support immutable trpc servers using lambdas to ensure client/server compatibility

auto-versioned-trpc-aws-lambda Proof of concept to support an automatically versioned AWS Lambda running tRPC to ensure a somewhat graceful and automa

Kenneth Skovhus 5 Aug 30, 2022
tRPC test & precursor to a billion dollar social cat network

CatMash What is this? Have you ever wanted to rank 11,000 cat pictures by cuteness? Of course you have. That's what we're doing here. This is an app b

Christopher Ehrlich 6 Dec 18, 2022
OpenAPI support for tRPC 🧩

trpc-openapi OpenAPI support for tRPC ?? Easy REST endpoints for your tRPC procedures. Perfect for incremental adoption. OpenAPI version 3.0.3. Usage

James Berry 841 Jan 9, 2023
NX monorepo showing the TMDB Watchlist mobile app with Expo, tRPC, Next, and Prisma

tmdb-watchlist-prisma This app uses TMDB to retrieve a list of Now Playing movies. You can add/remove movies to track which ones you've watched. There

Mat Warger 65 Dec 28, 2022