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

tag-rpc

v1.1.7

Published

End-to-end type safety for Next.js Route Handlers

Readme

TagRPC Note: Stable versions start from 1.1.5

End-to-end type safety for Next.js Route Handlers. TagRPC bridges the gap between your Next.js API routes and your frontend with zero boilerplate and 100% type safety using simple XML-like tags.

Features Zero Schemas: No Zod or Valibot required. Define your types directly in your route.ts file using standard TypeScript syntax.

Auto-Generation: A watcher process tracks your app/api folder and updates types instantly as you save files.

Named Routes: Access your APIs by function name (e.g., api.getUser()) instead of manually managing URL strings like /api/users/[id].

Ultra-Lightweight: There are zero runtime dependencies in your production bundle.

Installation Bash npm install tag-rpc Setup

  1. Tag Your Routes Inside any app/api/**/route.ts file, add tags inside a backtick string to define your route's metadata. The scanner will parse these tags to build your registry.

TypeScript Example // app/api/users/[id]/route.ts

<GetRouteName> getUser </GetRouteName> <GetResponseType> id: string; name: string; email?: string; </GetResponseType> <GetRequestType> id: string; name: string; </GetRequestType> <GetQueryType> includeemail: string; </GetQueryType>

export async function GET(req: Request, { params }: { params: { id: string } }) { // Your implementation logic } 2. Run the Scanner Add the scanner to your package.json scripts to keep your types in sync during development.

JSON Example "scripts": { "rpc": "tag-rpc", "rpc:watch": "tag-rpc --watch", "build": "tag-rpc && next build" } 3. Initialize the Client and Helper Types Create an initialization file (e.g., lib/api.ts). This setup generates the client and exports helper types for use throughout your application.

TypeScript Example import { createTagRPC, TypeOf } from 'tag-rpc'; import { ApiRoutes, namedRoutes } from '@/rpc/api-registry'; // Paths from generated file

// Initialize the RPC client export const api = createTagRPC<ApiRoutes, typeof namedRoutes>({ namedRoutes });

// Export helper types for Responses, Queries, and Requests export type RouteResponse = TypeOf<ApiRoutes, typeof namedRoutes, K, "Response">;

export type RouteQuery = TypeOf<ApiRoutes, typeof namedRoutes, K, "Query">;

export type RouteRequest = TypeOf<ApiRoutes, typeof namedRoutes, K, "Request">; Usage You can now utilize full autocomplete and type safety in your React components. The client automatically knows the path parameters, query parameters, and response shapes.

TypeScript Example // components/UserCard.tsx import { api } from '@/lib/api';

const UserCard = async ({ id }: { id: string }) => { // Fully typed: provides IDE completion for pathParams and the response object const user = await api.getUser({ pathParams: { id } });

return <div>{user.name}</div>;

} Configuration (Optional) Create a tagrpc.config.ts (or .mjs) in your root directory to customize the scanning behavior. Run: npx tagrpc-generate-config

TypeScript Example

export default { appDir: 'app', apiRoutesDir:"app/api",// Location of your Next.js route handlers folder outputFile: 'app/api-registry.ts'// Destination for generated types

}; License MIT © Kelvin Mitau