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

@ez-rpc/router

v0.1.0

Published

Type-safe Express router with Zod validation, in-flight deduplication, and concurrency queuing.

Readme

@ez-rpc/router

npm license

An Express router that validates inputs and outputs against your Zod schemas automatically. You write the handler logic — it handles the validation, error responses, deduplication, and queuing.

Install

npm install @ez-rpc/router express zod
npm install --save-dev @types/express

Usage

Define your endpoints as a plain object with Zod schemas, then pass them to createRouter:

// contract/user.ts
import { z } from "zod";
import type { Endpoint } from "@ez-rpc/core";

export const userEndpoints = {
  getUsers: {
    output: z.array(UserSchema),
  } satisfies Endpoint,
  createUser: {
    input: z.object({ name: z.string(), email: z.string().email() }),
    output: UserSchema,
  } satisfies Endpoint,
} as const;

// server/routes/user.ts
import { createRouter } from "@ez-rpc/router";
import { userEndpoints } from "../../contract/user";

export const userRouter = createRouter(userEndpoints, authMiddleware).implement({
  getUsers: {
    handler: async (_input, req) => getUsersFromDB(req.pool),
  },
  createUser: {
    handler: async (input, req) => createUserInDB(req.pool, input),
  },
});

app.use("/user", userRouter);

For each route, the router validates the request body before calling your handler and validates the return value before sending the response. A bad input is a 400. A schema mismatch on the output is a 500. Both use the same Zod schemas your client is typed against — so compile-time and runtime stay in agreement.

Concurrency queuing

Plug in a createConcurrencyQueue from @ez-rpc/concurrency to cap concurrent executions per route:

import { createConcurrencyQueue } from "@ez-rpc/concurrency";

const reportQueue = createConcurrencyQueue({ globalCap: 4, perUserCap: 1 });

const router = createRouter(reportEndpoints, authMiddleware).implement({
  generateReport: {
    handler: generateReportHandler,
    queue: { queue: reportQueue, key: (input) => input.projectId },
  },
});

Other features

  • In-flight deduplication — identical concurrent requests resolve from one promise instead of hitting your handler multiple times
  • NDJSON streaming — mark an endpoint streaming: true and write rows as they come; the client reassembles them
  • HMAC signature verification — validates signed requests from @ez-rpc/client
  • createDBServiceHandler — one-liner adapter for @ez-rpc/mssql services:
import { createDBServiceHandler } from "@ez-rpc/router";

const userRouter = createRouter(userEndpoints, authMiddleware).implement({
  getUsers: { handler: createDBServiceHandler(getUsersService) },
});

Full docs

See the ez-rpc README for streaming, signing, and more.