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-new-express-project

v3.1.1

Published

CLI to create express app in MVC pattern

Readme

🚀 Express MVC Starter

Express.js starter boilerplate with MVC architecture

📝 Introduction

A professional Express.js starter boilerplate designed for scalable and production-ready Node.js applications. It provides a clean MVC structure, multiple database templates, validation options, developer tooling, and deployment support.


📦 Features

Express.js – Fast, minimalist web framework
MVC Architecture – Clean separation of Models, Views, Controllers
Multiple Database Templates – MySQL, PostgreSQL, Mongoose (MongoDB), Sequelize
Validators – Joi or express-validator (configurable)
Environment Config – dotenv-based configuration
Security – Helmet, CORS, Rate Limiting
Logging – Centralized logger with levels & transports
File Uploads – Multer integration
Mail Service – Nodemailer support
API Documentation – Swagger (OpenAPI)
Testing – Jest setup out of the box
Linting & Formatting – ESLint & Prettier
Process Management – PM2 for production
Hot Reloading – nodemon for development


🧩 Templates

You can choose a database template during project creation:

  • MySQL – Traditional relational database setup
  • PostgreSQL – Advanced relational database with strong consistency
  • Mongoose – MongoDB ODM for NoSQL applications
  • Sequelize – ORM supporting MySQL, PostgreSQL, and more

Language support:

  • JavaScript (default)
  • TypeScript (recommended for large & scalable projects)

🧪 Validators

Validation can be enabled during setup (fully supported in JavaScript & TypeScript):

  • Joi – Schema-based request validation
  • express-validator – Middleware-based validation for Express routes

🛠 Tools Included

  • ESLint & Prettier – Code quality and formatting
  • Nodemailer – Email sending utility
  • Multer – File upload handling
  • Jest – Unit and integration testing
  • Swagger – API documentation and testing UI
  • PM2 – Production process manager
  • nodemon – Auto-restart server during development

⚙️ Installation

Create a new project using NPX or NPM:

npx create-new-express-project <project-name>
# or
npm create new-express-project <project-name>

👍 Help

Usage: create-new-express-project <project-name> [options]

CLI to create Express app in MVC pattern

Options:
  -V, --version    output the version number
  -m, --mongoose   Setup Mongoose
  -M, --mysql      Setup MySQL
  -p, --postgres   Setup Postgres
  -S, --sequelize  Setup Sequelize
  -h, --help       display help for command

📋 Interactive Prompts

✔ Preferred language: JavaScript
✔ Select Template: MySQL / PostgreSQL / Mongoose / Sequelize
✔ Choose Validator: Joi / express-validator
✔ Select Tools: Linting / Testing / Swagger / Deployment

After setup:

cd <project-name>
npm install
npm run dev

🔧 Environment Configuration

Create a .env file in the root directory:

APP_PORT=3000
NODE_ENV=development

# Database configuration
DB_HOST=localhost
DB_PORT=3306
DB_NAME=app_db
DB_USER=root
DB_PASSWORD=secret

# Mail configuration
MAIL_HOST=smtp.example.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=your_password

🚦 Running the Application

# Development mode (nodemon)
npm run dev

# Production mode
npm start

# Run tests
npm run test

Server will start at: 👉 http://localhost:3000


📜 NPM Scripts

| Command | Description | | -------------------- | ---------------------------------------- | | npm run dev | Start with nodemon | | npm start | Run app in production | | npm run build | Compile TypeScript to JavaScript |

ESLint & Prettier

| Command | Description | | ----------------------- | ------------------------------------- | | npm run lint | Run ESLint to check code quality | | npm run lint:fix | Automatically fix ESLint issues | | npm run format | Check code formatting using Prettier | | npm run format:fix | Format code using Prettier |

Testing

| Command | Description | | ----------------------- | ------------------------------------- | | npm run test | Run unit tests with Jest | | npm run test:coverage | Run tests with coverage reports |

Database Migrations (Sequelize)

| Command | Description | | --------------------- | ----------------------------------------------- | | npm run db:migrate | Create database tables based on model files | | npm run db:refresh | Drop all tables and recreate from model files | | npm run db:seed | Populate database with seed data |

Deployment (PM2)

| Command | Description | | ----------------------- | ------------------------------------- | | npm run pm2:start | Start application with PM2 | | npm run pm2:restart | Restart PM2 process | | npm run pm2:stop | Stop PM2 process |


📖 API Documentation

Swagger UI is available at: 👉 http://localhost:3000/api-docs


🗂 Folder Structure

my-express-app/
│
├── src/
│   ├── config/          # App, database, and environment configs
│   ├── controllers/     # Request handlers (business logic)
│   ├── models/          # Database models / schemas
│   ├── repositories/    # Database query layer
│   ├── routes/          # API route definitions
│   ├── middlewares/     # Custom Express middlewares
│   ├── validators/      # Joi / express-validator schemas
│   ├── services/        # Reusable services (mail, file upload, etc.)
│   ├── utils/           # Helper utilities (logger, constants)
│   ├── public/          # Static assets
│   ├── tests/           # Unit & integration tests
│   ├── views/           # View templates (if enabled)
│   ├── app.js           # Express app entry
│   └── server.js        # Application bootstrap
│
├── uploads/             # Uploaded files (multer)
├── swagger.yaml         # Swagger API documentation
├── ecosystem.config.js  # PM2 configuration
├── .env.example         # Environment variable sample
└── package.json

🧰 Tech Stack

  • Node.js
  • Express.js
  • MySQL / PostgreSQL / MongoDB
  • Sequelize / Mongoose
  • Joi / express-validator
  • Multer
  • Nodemailer
  • Swagger (OpenAPI)
  • Jest
  • PM2

🧾 License

This project is licensed under the MIT License – free to use and modify.


🌟 Contributing

Contributions, issues, and feature requests are welcome! Feel free to open a pull request.


💡 Author

Karthikeyan M 👨‍💻 GitHub