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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nest-module-cli

v1.0.2

Published

A powerful CLI tool to generate NestJS modules with customizable templates

Readme

Nest Module CLI

A powerful CLI tool to generate NestJS modules with customizable templates for modules, controllers, services, DTOs, and schemas.

Features

  • 🚀 Quick module generation with a single command
  • 📝 Customizable templates using stub files
  • 🎯 Automatic pluralization/singularization
  • 🔧 Configurable exclusions per module
  • 📦 Batch generation support
  • 🎨 Multiple naming conventions (PascalCase, camelCase, kebab-case, snake_case)

Installation

Global Installation (Recommended)

npm install -g nest-module-cli

Local Installation

npm install --save-dev nest-module-cli

Usage

Initialize Templates

First, initialize the templates directory:

nest-module init

This creates a templates/ folder with default stub files for:

  • Module
  • Controller
  • Service
  • Create DTO
  • Update DTO
  • Schema (Mongoose)

Generate a Module

Generate a single module:

nest-module generate users

Generate multiple modules:

nest-module generate users products orders

Batch Generation

Generate all modules defined in your config:

nest-module batch

Using npm Scripts

Add to your package.json:

{
  "scripts": {
    "generate": "nest-module generate",
    "generate:init": "nest-module init",
    "generate:batch": "nest-module batch"
  }
}

Then run:

npm run generate users
npm run generate:batch

Configuration

Create a generator.config.js file in your project root:

module.exports = {
  templatesDir: './templates',
  outputDir: './src/modules',
  
  templates: {
    module: { extension: 'module.ts', required: true },
    controller: { extension: 'controller.ts', required: true },
    service: { extension: 'service.ts', required: true },
    'create-dto': {
      extension: 'dto.ts',
      required: false,
      outputPath: 'dto',
      filename: 'create-{{singularName}}.dto.ts'
    },
    'update-dto': {
      extension: 'dto.ts',
      required: false,
      outputPath: 'dto',
      filename: 'update-{{singularName}}.dto.ts'
    },
    schema: {
      extension: 'schema.ts',
      required: false,
      outputPath: 'schema',
      filename: '{{singularName}}.schema.ts'
    }
  },
  
  exclusions: {
    'create-dto': ['auth'],
    'update-dto': ['auth'],
    schema: ['auth', 'sidebar']
  },
  
  batchModules: [
    'users',
    'products',
    'orders'
  ]
};

Template Placeholders

Use these placeholders in your .stub files:

  • {{moduleName}} - users
  • {{ModuleName}} - Users
  • {{module_name}} - users
  • {{module-name}} - users
  • {{camelModuleName}} - users
  • {{MODULE_NAME}} - USERS

Singular versions:

  • {{singularName}} - user
  • {{SingularName}} - User
  • {{singular_name}} - user
  • {{singular-name}} - user
  • {{camelSingularName}} - user
  • {{SINGULAR_NAME}} - USER

Generated Structure

src/modules/users/
├── users.module.ts
├── users.controller.ts
├── users.service.ts
├── dto/
│   ├── create-user.dto.ts
│   └── update-user.dto.ts
└── schema/
    └── user.schema.ts

Custom Templates

You can customize any template by editing the .stub files in the templates/ directory after running nest-generate init.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Author

Your Name

Support

For issues and questions, please visit GitHub Issues