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

@kasdovel/express-sdkgen-core

v0.0.0

Published

Runtime helpers: createRoute, registry, request validation, serveDocs middleware

Readme

@kasdovel/express-sdkgen-core

Runtime helpers for sdkgen to declare type-safe routes, perform runtime request validation, and serve API documentation.

Installation

npm install @kasdovel/express-sdkgen-core zod express
# or
pnpm add @kasdovel/express-sdkgen-core zod express
# or
yarn add @kasdovel/express-sdkgen-core zod express

Features

  • Zero-Drift Route Definitions: Declare route schemas once using Zod. The same declaration validates incoming requests at runtime, types the handlers, and powers the generated OpenAPI spec, docs, and SDK.
  • Request Validation: Automatically validates params, query, body, and headers against Zod schemas. Invalid requests receive a structured 400 Bad Request response.
  • Type Safety: Handlers automatically infer types for validated request parameters from Zod schemas under req.valid.
  • Nested Routers: Create modular, nested APIs with prefix-aware routers that correctly serialize to OpenAPI paths.
  • Live Documentation: Serve interactive Swagger/Redoc API documentation directly from your running Express application.

Usage

1. Declare routes with createRoute

import { Router } from 'express';
import { z } from 'zod';
import { createRoute } from '@kasdovel/express-sdkgen-core';

export const router = Router();

createRoute(router, {
  method: 'post',
  path: '/users/:id',
  operationId: 'updateUser',
  request: {
    params: z.object({ id: z.string() }),
    body: z.object({ name: z.string().min(1) }),
  },
  responses: { 200: z.object({ id: z.string(), name: z.string() }) },
  handler: (req, res) => {
    // req.valid.params.id and req.valid.body.name are fully typed + validated
    res.json({ id: req.valid.params.id, name: req.valid.body.name });
  },
});

2. Nest Routers with prefix-aware router

To mount routers under a prefix and preserve complete paths in the generated OpenAPI spec:

import { router } from '@kasdovel/express-sdkgen-core';

const accounts = router('/accounts');

accounts.route({
  method: 'get',
  path: '/',
  operationId: 'listAccounts',
  responses: { 200: AccountListSchema },
  handler: (req, res) => { ... },
});

// Nesting sub-routers
const admins = accounts.router('/admins');
admins.route({
  method: 'get',
  path: '/:id',
  operationId: 'getAdmin',
  responses: { 200: AdminSchema },
  handler: (req, res) => { ... },
});

// Mount the top-level router onto the Express app
accounts.mount(app);

3. Serve live documentation

Serve Swagger UI or Redoc documentation from the in-memory route registry:

import { registry, serveDocs } from '@kasdovel/express-sdkgen-core';
import express from 'express';

const app = express();

// Serve docs at /docs
await serveDocs(app, {
  registry,
  title: 'My Express API',
  version: '1.0.0',
  path: '/docs',
});

License

MIT