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

trpc-devtools

v0.1.7

Published

A modern developer tooling solution for tRPC APIs. More than just a Swagger UI - a full-fledged dev toolkit for tRPC developers.

Readme

trpc-devtools

A modern developer tooling solution for tRPC APIs. More than just a Swagger UI - a full-fledged dev toolkit for tRPC developers.

Features

  • Router Introspection: Automatically extracts procedure schemas using Zod v4's native z.toJSONSchema()
  • Zero-Config Setup: Works with a single line of code via route handler
  • Component Library: Use as a standalone component for full control
  • Request Execution: Execute tRPC procedures directly from the browser
  • Request History: Persists request/response history in localStorage
  • SuperJSON Support: Auto-detects and handles SuperJSON responses
  • Dark Mode: Built-in light and dark theme support

Requirements

  • tRPC v11
  • Zod v4
  • Next.js 14, 15, or 16
  • React 18 or 19

Installation

pnpm add trpc-devtools

Usage

Option 1: Route Handler (Zero-Config)

// app/api/trpc-studio/[[...studio]]/route.ts
import { createTRPCStudio } from 'trpc-devtools/server';
import { appRouter } from '@/server/routers';

const handler = createTRPCStudio({
    router: appRouter,
    url: '/api/trpc',
});

export { handler as GET, handler as POST };

Then visit /api/trpc-studio to view the full studio UI.

Option 2: Component Library (Full Control)

// app/dev/studio/page.tsx
import { TRPCStudio } from 'trpc-devtools';
import 'trpc-devtools/styles.css';

export default function StudioPage() {
    return (
        <TRPCStudio schemaUrl="/api/trpc-studio/schema" trpcUrl="/api/trpc" />
    );
}

API Reference

Imports

// Server-side (Node.js only)
import { createTRPCStudio, introspectRouter } from 'trpc-devtools/server';

// Client-side (React components)
import { TRPCStudio } from 'trpc-devtools';
import 'trpc-devtools/styles.css';

createTRPCStudio(config)

Creates a Next.js route handler for the studio.

interface TRPCStudioConfig {
    router: AnyRouter; // Your tRPC router
    url: string; // URL of your tRPC endpoint
    auth?: AuthConfig; // Optional auth configuration
    basePath?: string; // Optional base path override
}

interface AuthConfig {
    headers?: Record<string, string>; // Headers for tRPC requests
    isAuthorized?: (req: Request) => boolean | Promise<boolean>;
}

Authentication Examples

Restrict access to admins (BetterAuth):

const handler = createTRPCStudio({
    router: appRouter,
    url: '/api/trpc',
    auth: {
        isAuthorized: async (req) => {
            const session = await auth.api.getSession({ headers: req.headers });
            return session?.user?.role === 'admin';
        },
    },
});

API key authentication:

const handler = createTRPCStudio({
    router: appRouter,
    url: '/api/trpc',
    auth: {
        headers: {
            'X-API-Key': process.env.INTERNAL_API_KEY!,
        },
    },
});

<TRPCStudio />

React component for the studio UI.

interface TRPCStudioProps {
    schemaUrl: string; // URL to fetch the schema
    trpcUrl: string; // URL of the tRPC endpoint
    headers?: Record<string, string>; // Custom headers
    className?: string; // Additional CSS classes
}

introspectRouter(router)

Introspect a router and extract procedure schemas.

import { introspectRouter } from 'trpc-devtools/server';

const schema = introspectRouter(appRouter);
// Returns: { procedures: [...], version: 1, generatedAt: '...' }

Theming

The studio uses CSS custom properties for theming. Override in your CSS:

:root {
    --color-primary: hsl(220 90% 56%);
    --color-background: hsl(0 0% 100%);
    /* ... */
}

.dark {
    --color-background: hsl(222 84% 5%);
    /* ... */
}

Development

# Watch mode
pnpm -F trpc-devtools dev

# Build
pnpm -F trpc-devtools build

# Typecheck
pnpm -F trpc-devtools typecheck

License

MIT