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

leo-generator

v1.0.0

Published

Generate Express modules with Mongoose models

Readme

Leo Generate - Module Generator for Express & Mongoose

I'll update the README.md file to change the module generator name from "SIUUU Module Generator" to "Leo Generate" and provide a detailed description.

# Leo Generate

A powerful module generator for Express.js applications with Mongoose models.

## Features

- 🚀 Rapid module scaffolding
- 📁 Complete folder structure
- 🧩 TypeScript interfaces
- 🔄 Mongoose models
- 🎮 Express controllers
- 🛠️ Service layer
- 🛣️ RESTful routes
- ✅ Zod validation
- 🎨 Clean and consistent code structure
- 🔣 Support for enum fields with predefined values

## Installation

```bash
npm install leo-generate --global

Or use with npx:

npx leo-generate

Quick Start

Generate a basic module:

leo-generate User name:string email:string age:number

This creates:

src/app/modules/user/
├── user.interface.ts   // TypeScript interfaces
├── user.model.ts      // Mongoose model
├── user.controller.ts // CRUD controllers
├── user.service.ts    // Business logic
├── user.route.ts      // Express routes
├── user.validation.ts // Zod validation
└── user.constants.ts  // Constants

Configuration

Via package.json

{
  "moduleGenerator": {
    "modulesDir": "src/app/modules",
    "routesFile": "src/routes/index.ts"
  }
}

Via CLI

leo-generate User --modules-dir src/modules --routes-file src/routes.ts

Examples

Basic CRUD Module

leo-generate Product name:string price:number description:string

Module with Required Fields

leo-generate User name!:string email!:string age:number

The ! marks a field as required in the model and validation.

Module with Optional Fields

leo-generate Post title:string content:string author?:string

The ? marks a field as optional.

Module with References

leo-generate Order items:array:objectid:Product customer:objectid:User

Module with Enum Values

leo-generate Product name:string category:enum[Electronics,Clothing,Food] status:enum[Active,Inactive]

Module with Nested Objects

leo-generate Order customer:object customerId:string name:string address:string

Module with Array of Objects

leo-generate Product name:string variants:array:object name:string price:number stock:number

Module with File Upload

leo-generate Product name:string price:number image:string

Generated Files

Interfaces

  • TypeScript interfaces for type safety
  • Support for nested objects and arrays
  • Proper MongoDB typing with ObjectId

Models

  • Mongoose schema definitions
  • Proper field types and validations
  • Support for references and nested schemas

Controllers

  • Full CRUD operations
  • File upload handling
  • Proper error handling
  • Response formatting

Routes

  • RESTful endpoints
  • Validation middleware
  • File upload middleware
  • Authentication hooks

Validation

  • Request body validation
  • Type checking
  • Custom error messages
  • Required/optional fields

API Endpoints

For a module named "Product":

POST   /api/v1/products      - Create product
GET    /api/v1/products      - Get all products
GET    /api/v1/products/:id  - Get single product
PATCH  /api/v1/products/:id  - Update product
DELETE /api/v1/products/:id  - Delete product

Best Practices

  1. Use singular names for modules (e.g., "User" not "Users")
  2. Mark required fields with "!"
  3. Use descriptive field names
  4. Follow naming conventions for file fields (image, file, media)
  5. For enum fields, use the format fieldname:enum[VALUE1,VALUE2,VALUE3]

Common Patterns

File Upload Module

leo-generate Media title:string description:string file:string

User Authentication Module

leo-generate User name!:string email!:string password!:string role:enum[admin,user,editor]

Blog Post Module

leo-generate Post title!:string content!:string author:objectid:User tags:array:string status:enum[draft,published,archived]

Contributing

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

License

MIT