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

moh-projectgen

v1.0.27

Published

Project generator for DDD-based Node/TS architecture

Readme

moh-projectgen

moh-projectgen is a TypeScript-based project scaffolding tool designed to generate fully structured, production-ready Node.js microservices following Domain-Driven Design (DDD), modular architecture, and GraphQL-first patterns.

This generator is the evolution of an earlier Bash-based setup script. It preserves 100% of the original output, but is now cross‑platform, more maintainable, and packaged as a CLI utility that can be shared across the engineering team.


Features

Generates a complete Node.js microservice

  • Express + GraphQL
  • Sequelize + MySQL
  • RabbitMQ integration
  • DDD folder structure
  • Error handling middleware
  • Token/session validation
  • Logger configuration
  • Full ready-to-run application

Part of a 3‑tool ecosystem

This package works alongside:

| Package | Purpose | | ---------------- | ------------------------------------------------------------------------------------------------------ | | moh-modelgen | Connects to MySQL and automatically generates Sequelize model files. | | moh-codegen | Generates CRUD modules based on a model: controllers, services, usecases, validations, resolvers, etc. |

Together, these tools drastically reduce boilerplate, enforce architecture standards, and accelerate development.


Package Structure (CLI Tool)

Your package has the following structure:

moh-projectgen/
│
├─ bin/
│   └─ cli.js              # Compiled CLI entry
│
├─ src/
│   ├─ index.ts            # Exports the generator
│   ├─ generator.ts        # Generator logic
│   └─ templates/          # All project template files
│        ├─ package.json.txt
│        ├─ tsconfig.json.txt
│        ├─ .env.example.txt
│        ├─ src/app.ts.txt
│        ├─ src/server.ts.txt
│        ├─ src/config/... (all config templates)
│        ├─ src/utils/... (all utility templates)
│        ├─ src/api/...   (GraphQL schema/resolvers templates)
│        └─ ... (EVERY file from the original Bash script)
│
├─ package.json
├─ tsconfig.json
└─ README.md

DDD Architecture Overview

The generator creates a project using a clean Domain-Driven Design (DDD) structure.

src/
├─ api/              # GraphQL schemas + resolvers
├─ config/           # Config + env loaders
├─ database/         # Models, migrations, seeders
├─ interfaces/       # Contracts / abstractions
│   ├─ events/
│   ├─ repositories/
│   ├─ service/
│   └─ usecases/
├─ repositories/     # Sequelize repository implementations
├─ services/         # Business logic services
├─ usecases/         # Application logic
├─ utils/            # Helpers, filters, errors, etc.
└─ types/            # Shared TS types

Why DDD?

  • Separation of business logic from infrastructure
  • Encourages modularity
  • Easier to scale and test
  • Enables code generators (like moh-codegen)

Part of the MOH Development Ecosystem

moh-modelgen (Database → Models)

moh-modelgen connects to a live MySQL database and automatically generates Sequelize model files.

Features:

  • Auto-detects tables
  • Auto-detects columns + types
  • Generates TypeScript model definitions
  • Generates associations (belongsTo, hasMany, etc.)
  • Produces output compatible with moh-projectgen

Usage:

npx moh-modelgen --host localhost --user root --password pass --db mydb --out src/database/models

This reduces hours of manual model writing down to a single command.


moh-codegen (Module Creator)

moh-codegen generates a full CRUD module with:

  • GraphQL schema
  • GraphQL resolvers
  • Service layer
  • Use cases
  • Repository logic
  • Input validation
  • DTOs
  • Types

Usage

moh-codegen make:module <name> --model <ModelName> --validate

Example

moh-codegen make:module Customer --model CustomerModel --validate

This will generate:

src/modules/customer/
├─ customer.schema.ts
├─ customer.resolver.ts
├─ customer.service.ts
├─ customer.usecase.ts
├─ customer.repository.ts
├─ customer.validation.ts
└─ index.ts

All wired together and ready to integrate.


🛠 Installation

Install globally:

npm install -g moh-projectgen

Generate a new project:

moh-projectgen MyService

🧪 Development (for contributors)

To work on the generator itself:

npm install
npm run build
npm link

Then test locally:

moh-projectgen test-service

Summary

moh-projectgen is the foundation of your service ecosystem.

Together with:

  • moh-modelgen (database → models)
  • moh-codegen (models → modules)

You now have a complete, automated, production-grade development workflow.

If you want, I can also:

  • generate the full template folder, filled with all 120+ files
  • generate documentation for modelgen and codegen separately
  • add schematics or presets for microservice types
  • publish this as a ready npm package

Just let me know! 🚀