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

@alt-stack/server-nestjs

v1.5.1

Published

Type-safe Alt Stack server integration for NestJS (Express) with Zod validation

Readme

@alt-stack/server-nestjs

NestJS integration for Altstack routers on @nestjs/platform-express. It adds Nest provider lookup, request-scoped resolution, global-prefix-aware mounting, optional OpenAPI docs, and an Altstack-to-Nest middleware bridge.

Quickstart

pnpm add @alt-stack/server-nestjs @nestjs/common @nestjs/core @nestjs/platform-express express zod reflect-metadata
import "reflect-metadata";
import { Module } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
import {
  init,
  ok,
  registerAltStack,
  type NestAppLike,
} from "@alt-stack/server-nestjs";

@Module({})
class AppModule {}

const t = init();
const api = t.router({
  "/health": t.procedure.get(() => ok({ ready: true })),
});

const app = await NestFactory.create(AppModule);
app.setGlobalPrefix("v1");

registerAltStack(app as unknown as NestAppLike, { "/": api }, {
  mountPath: "/api",
});

await app.listen(3000);
// GET /v1/api/health

See the full server quickstart.

Common Patterns

  • Pass only app-specific fields to init<TCustomContext>(); the Nest wrapper automatically adds NestBaseContext.
  • Resolve regular providers with ctx.nest.get(Token) and request-scoped/transient providers with await ctx.nest.resolve(Token).
  • Call setGlobalPrefix() before registerAltStack(). respectGlobalPrefix defaults to true and avoids double-prefixing.
  • Pass factory.defaultErrorHandlers explicitly when using custom/default factory payloads.
  • Use createNestMiddleware() to run an Altstack middleware function/builder in conventional Nest controller routes and carry context overrides into registered Altstack routes.
  • Add docs: { path: "/docs", title, version } to mount Swagger UI and OpenAPI JSON.

Current caveats: only the Express Nest platform is supported. Registered routes inherit Express behavior, including synchronous output parsing and no Web Response passthrough. Nest/global mount prefixes do not appear automatically in generated OpenAPI path keys. Declared runtime errors are enveloped while generated error schemas are flat.

See Server common patterns.

API Documentation

NestJS API Documentation covers registerAltStack, RegisterAltStackOptions, RegisterAltStackDocsOptions, NestAppLike, the Nest init() wrapper, NestBaseContext, NestServiceLocator, createNestMiddleware, CreateNestMiddlewareOptions, typed router helpers, and exact core re-exports.

Peer dependencies

  • @nestjs/common, @nestjs/core, @nestjs/platform-express: ^9.0.0 || ^10.0.0 || ^11.0.0
  • express: ^4.0.0 || ^5.0.0
  • zod: ^4.0.0

License

MIT