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

create-nest-arch

v1.2.0

Published

CLI to scaffold NestJS projects with hexagonal, layered or microservice architecture

Readme

create-nest-arch

CLI to scaffold NestJS projects with Hexagonal Architecture, Microservices (TCP) or an API Gateway.

Fork of a thesis-driven tool, published for everyone: keep it generic, add your own domain.

Features

  • 3 project types with battle-tested defaults:
    • hexagonal — Hexagonal / Clean Architecture monolith (application, domain, infrastructure).
    • microservice — Pure TCP microservice with full CRUD + soft delete.
    • gateway — HTTP API Gateway ready to forward messages to your microservices (Redis + rate limiting included).
  • Prisma + PostgreSQL wired out of the box (db:generate, db:migrate).
  • Correct naming out of the box: ms-rooms → entity Room, message patterns rooms.*.
  • Class validation, common filters/interceptors, e2e tests, Docker & docker-compose.
  • Zero config: answer 3 prompts and you're done.

Quick Start

# pnpm (recommended)
pnpm dlx create-nest-arch

# npm
npx create-nest-arch

# global install
npm install -g create-nest-arch
create-nest-arch

You can also pass the project name as the first argument:

npx create-nest-arch ms-rooms

The CLI asks:

  1. Project name — e.g. ms-rooms.
  2. Project type — Hexagonal | Microservice Module | API Gateway.
  3. Add Docker support? — yes/no.

Generated projects

Microservice Module (microservice)

A pure TCP microservice (no HTTP routes). Only other services can talk to it.

ms-rooms/
├── prisma/schema.prisma          # Room model + @@map("rooms")
├── src/
│   ├── main.ts                   # TCP transport, port 3001
│   ├── app.module.ts
│   └── room/                     # entity derived from the project name
│       ├── dto/create-room.dto.ts
│       ├── dto/update-room.dto.ts
│       ├── entities/room.entity.ts
│       └── main/
│           ├── room.controller.ts  # @MessagePattern({ cmd: 'rooms.*' })
│           ├── room.service.ts     # CRUD + soft delete (isActive)
│           └── room.module.ts

Message patterns exposed:

| Pattern | Payload | Description | | --- | --- | --- | | rooms.create | CreateRoomDto | Create a room | | rooms.findAll | — | List active rooms | | rooms.findOne | { id } | Find one active room | | rooms.update | { id, ...UpdateRoomDto } | Update a room | | rooms.remove | { id } | Soft delete (isActive = false) |

Naming convention: ms-rooms, users-service → entity Room, User and patterns rooms.*, users.*.

Hexagonal Monolith (hexagonal)

Clean architecture layering: application/, domain/, infrastructure/.

src/modules/my-app/
├── application/
│   ├── dtos/{requests,responses}
│   └── use-cases/{commands,queries}
├── domain/
│   ├── entities/
│   ├── factories/
│   ├── interfaces/
│   └── services/{commands,queries}
└── infrastructure/
    ├── adapters/{ports,implements}
    ├── config/
    └── controllers/

API Gateway (gateway)

HTTP entry point ready to forward messages to microservices over TCP.

src/
├── app.controller.ts        # GET /health
├── app.module.ts
├── common/                  # filters, guards, interceptors, decorators
├── config/app.config.ts
├── modules/
├── redis/                   # Redis module + service
├── throttle/                # rate limiting (ThrottlerModule)
├── types/                   # shared response types
└── utils/

Running a generated project

cd ms-rooms
cp .env.example .env
pnpm install
pnpm db:generate
pnpm db:migrate
pnpm start:dev

With Docker:

cp .env.example .env
docker-compose up -d

Tech stack

  • NestJS 10
  • Prisma + PostgreSQL
  • TCP transport via @nestjs/microservices
  • class-validator / class-transformer
  • Redis (gateway), Throttler (rate limiting)

License

MIT