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

@ldpld/create-node-mvc

v0.1.1

Published

Express.js MVC Scaffold Generator - Create production-ready Node.js projects with dual-route architecture

Downloads

73

Readme

create-node-mvc

Express.js MVC Scaffold Generator - Create production-ready Node.js projects with dual-route architecture.

Installation

Install globally via npm:

npm install -g create-node-mvc

Or use with npx (no installation required):

npx create-node-mvc my-project

Usage

create-node-mvc <project-name>

The CLI will guide you through an interactive setup with the following options:

  • API-only architecture: Generate API routes only (no view rendering)
  • Include authentication: Add JWT-based authentication system
  • Additional features: Select from:
    • File uploads (express-fileupload)
    • Email service (nodemailer)
    • Testing setup (Jest + Supertest)
    • Tailwind CSS (with build pipeline)

Command Options

create-node-mvc <project-name> [options]

Options:

  • --skip-install: Skip automatic npm install after project generation

Examples:

# Create project with interactive prompts and auto-install
create-node-mvc my-api

# Create project and skip dependency installation
create-node-mvc my-api --skip-install

Running Tests

Run all tests:

npm test

Run tests with coverage:

npm test -- --coverage

Run specific test file:

npm test -- tests/project-structure.test.js

Update snapshots (when intentional changes occur):

npm test -- -u

Test execution time:

  • Unit tests: ~5-10 seconds
  • Integration tests: ~20-30 seconds (without server startup)
  • Server startup tests: ~2-3 minutes (includes npm install)
  • Full suite: ~3-4 minutes

Test coverage goals:

  • lib/ modules: >80% coverage
  • Integration coverage: All configuration combinations
  • Edge cases: Error handling scenarios

Development

Project Structure

cli/
├── bin/
│   └── create-node-mvc.js     # CLI entry point
├── lib/
│   ├── prompts.js             # Interactive questions
│   ├── fileOperations.js      # File copying/operations
│   ├── variableReplacer.js    # Template variable substitution
│   ├── featureIntegration.js  # Optional feature integration
│   └── dependencyInstaller.js # npm install automation
├── templates/
│   ├── base/                  # Core project template
│   └── optional/              # Feature-specific templates
└── tests/                     # Test suite

Adding New Features

  1. Add template files to templates/optional/<feature-name>/
  2. Update lib/featureIntegration.js with merge logic
  3. Add feature to prompts in lib/prompts.js
  4. Write tests in tests/feature-validation.test.js

Generated Project Structure

Full MVC Project (Default)

your-project/
├── config/
│   ├── config.env              # Environment configuration
│   └── db.js                   # MongoDB connection setup
├── controllers/
│   ├── api/
│   │   └── user.controller.js  # API endpoint handlers
│   ├── view/
│   │   └── user.controller.js  # View rendering handlers
│   └── error.js                # 404 error handler
├── middleware/
│   ├── advancedResults.js      # Query filtering, pagination
│   ├── async.js                # Async error wrapper
│   ├── auth.js                 # JWT authentication
│   └── error.js                # Global error handler
├── models/
│   └── User.js                 # Mongoose User model
├── routes/
│   ├── api/
│   │   └── user.routes.js      # API routes (/api/v1/users)
│   └── view/
│       └── user.routes.js      # View routes (/users)
├── utils/
│   ├── errorResponse.js        # Custom error class
│   ├── geocoder.js             # Geocoding utilities
│   ├── path.js                 # Path helpers
│   └── saveToDisk.js           # File upload utilities
├── views/
│   ├── users/
│   │   ├── list.ejs            # User list view
│   │   ├── show.ejs            # User detail view
│   │   ├── new.ejs             # Create user form
│   │   └── edit.ejs            # Edit user form
│   ├── partials/
│   │   ├── header.ejs          # Reusable header
│   │   └── footer.ejs          # Reusable footer
│   └── 404.ejs                 # Error page
├── public/
│   ├── css/
│   │   └── main.css            # Stylesheet
│   ├── src/imgs/
│   │   └── ava-img-blue.svg    # Example image
│   └── index.html              # Static homepage
├── .env.example                # Environment template
├── .gitignore                  # Git ignore rules
├── app.js                      # Express app entry point
├── package.json                # Dependencies
└── README.md                   # Project documentation

Dual-Route Architecture

Generated projects support both API and view routes:

  • API Routes (/api/v1/*): JSON responses for REST clients

    • Controllers: controllers/api/
    • Routes: routes/api/
    • Example: GET /api/v1/users → Returns JSON
  • View Routes (/*): Server-rendered EJS templates

    • Controllers: controllers/view/
    • Routes: routes/view/
    • Views: views/
    • Example: GET /users → Renders HTML page

API-Only Mode

When "API-only architecture" is selected, the structure excludes:

your-project/
├── config/
├── controllers/
│   ├── api/                    # ✓ API controllers only
│   └── error.js
├── middleware/
├── models/
├── routes/
│   └── api/                    # ✓ API routes only
├── utils/
├── .env.example
├── .gitignore
├── app.js
├── package.json
└── README.md

# Excluded in API-only mode:
# ✗ views/
# ✗ public/
# ✗ controllers/view/
# ✗ routes/view/

Optional Features

When selected, additional files are added:

Authentication (--auth):

  • controllers/api/protected.controller.js
  • routes/api/protected.routes.js
  • Enhanced middleware/auth.js
  • JWT environment variables in .env

File Upload (--fileupload):

  • controllers/api/upload.controller.js
  • routes/api/upload.routes.js
  • utils/fileUpload.js
  • Upload directory configuration

Email Service (--email):

  • controllers/api/email.controller.js
  • utils/sendEmail.js
  • SMTP environment variables

Testing (--testing):

  • tests/api/user.test.js
  • tests/setup.js
  • jest.config.js
  • Test scripts in package.json

Tailwind CSS (--tailwind):

  • tailwind.config.js
  • postcss.config.js
  • public/css/input.css
  • Enhanced view templates with Tailwind classes
  • Build scripts in package.json

License

MIT