npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

create-trpc-setup

v1.0.4

Published

One-command tRPC v11 setup for existing Next.js App Router projects — auto-detects Clerk, NextAuth, path alias, and patches layout.tsx

Downloads

510

Readme

create-trpc-setup

npm version npm downloads tRPC v11 Next.js License: MIT

One-command tRPC v11 setup for existing Next.js App Router projects.

npx create-trpc-setup

Demo


Why this exists

create-t3-app is great — but only for new projects.

create-trpc-setup works with projects you've already started.

| | create-t3-app | create-trpc-setup | | ----------------------------- | --------------- | ------------------- | | New projects | ✅ | ✅ | | Existing projects | ❌ | ✅ | | Auto-patches layout.tsx | ❌ | ✅ | | Clerk / NextAuth detection | ❌ | ✅ | | tsconfig path alias detection | ❌ | ✅ | | tRPC v11 + RSC | ✅ | ✅ |


What it does

npx create-trpc-setup
  1. ✅ Detects src/ or root layout
  2. ✅ Reads tsconfig.json for your path alias (@/*, ~/*, etc.)
  3. ✅ Detects Clerk or NextAuth — configures context automatically
  4. ✅ Installs all dependencies with your package manager
  5. ✅ Generates all 6 tRPC files
  6. Auto-patches layout.tsx — adds TRPCReactProvider inside <body>
  7. ✅ Creates /trpc-status page to verify setup

Files generated

trpc/
├── init.ts              ← context, baseProcedure, protectedProcedure, Zod error formatter
├── query-client.ts      ← SSR-safe QueryClient
├── client.tsx           ← TRPCReactProvider + useTRPC hook
├── server.tsx           ← prefetch, HydrateClient
└── routers/
    └── _app.ts          ← starter router with health + greet (Zod)

app/api/trpc/[trpc]/
└── route.ts             ← API handler with real headers + dev error logging

app/trpc-status/         ← test page (delete after confirming ✅)

Usage after setup

Server Component:

import { HydrateClient, prefetch, trpc } from "@/trpc/server";
import { MyClient } from "./my-client";

export default function Page() {
  prefetch(trpc.greet.queryOptions({ name: "World" }));
  return (
    <HydrateClient>
      <MyClient />
    </HydrateClient>
  );
}

Client Component:

"use client";
import { useSuspenseQuery } from "@tanstack/react-query";
import { useTRPC } from "@/trpc/client";

export function MyClient() {
  const trpc = useTRPC();
  const { data } = useSuspenseQuery(trpc.greet.queryOptions({ name: "World" }));
  return <div>{data.message}</div>;
}

Protected route:

// trpc/routers/_app.ts
getProfile: protectedProcedure.query(({ ctx }) => {
  return { userId: ctx.userId }; // guaranteed non-null
}),

Supported

  • Package managers: npm · pnpm · yarn · bun
  • Next.js: 14 · 15+
  • Auth: Clerk · NextAuth / Auth.js · None
  • Path aliases: @/* · ~/* · any custom alias from tsconfig.json

Author

Dhaval KurkutiyaGitHub · npm

If this saved you time, please ⭐ the repo — it helps others find it!


License

MIT