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

setup-mern

v1.0.3

Published

A CLI tool to generate a MERN backend boilerplate in seconds!

Readme

setup-mern

🚀 A CLI tool to generate a MERN backend boilerplate in seconds!

Features

  • Complete MERN Backend Boilerplate: Generates a fully functional folder structure for MERN backend development.
  • Pre-Configured with Best Practices: Includes essential files and configurations for Express, Mongoose, JWT, error handling, and more.
  • Scalable and Modular: Designed to be scalable and modular, making it easy to add new features or refactor existing ones.
  • Easy to Use: No global installation required. Simply use npx to generate your boilerplate.

Installation

No global installation required! Simply use npx to generate your boilerplate:

npx setup-mern my-new-project

Folder Structure and Purpose

Here’s a detailed explanation of the folder structure generated by setup-mern:

my-new-project/
├── src/
│   ├── config/                  # Configuration files
│   │   ├── db.js                # Database connection setup (Mongoose)
│   │   └── envConfig.js         # Environment variable configuration (dotenv)
│   ├── controllers/             # Controllers for handling request logic
│   │   ├── authController.js    # Authentication-related logic (e.g., login, signup)
│   │   ├── userController.js    # User-related logic (e.g., get user details)
│   │   └── postController.js    # Post-related logic (e.g., create, update, delete posts)
│   ├── middleware/              # Custom middleware
│   │   ├── authMiddleware.js    # Authentication middleware (JWT verification)
│   │   ├── errorMiddleware.js   # Global error handling middleware
│   │   └── validationMiddleware.js # Request validation middleware (e.g., Joi, Zod)
│   ├── models/                  # Database models (Mongoose Schemas)
│   │   ├── User.js              # User model (e.g., name, email, password)
│   │   └── Post.js              # Post model (e.g., title, content, author)
│   ├── routes/                  # API routes
│   │   ├── authRoutes.js        # Authentication routes (e.g., /api/v1/auth/login)
│   │   ├── userRoutes.js        # User routes (e.g., /api/v1/users)
│   │   └── postRoutes.js        # Post routes (e.g., /api/v1/posts)
│   ├── services/                # Business logic and service layer
│   │   ├── authService.js       # Authentication service (e.g., login, signup logic)
│   │   ├── userService.js       # User service (e.g., CRUD operations for users)
│   │   └── postService.js       # Post service (e.g., CRUD operations for posts)
│   ├── utils/                   # Utility functions and helpers
│   │   ├── apiFeatures.js       # Advanced filtering, sorting, and pagination
│   │   ├── catchAsync.js        # Async error handling wrapper
│   │   ├── email.js             # Email sending utility
│   │   └── logger.js            # Logging utility (e.g., winston)
│   ├── validations/             # Request validation schemas
│   │   ├── authValidation.js    # Validation for authentication routes
│   │   ├── userValidation.js    # Validation for user routes
│   │   └── postValidation.js    # Validation for post routes
│   ├── app.js                   # Main application setup (Express app, middleware, routes)
│   └── server.js                # Server entry point (starts the server)
├── tests/                       # Test files
│   ├── unit/                    # Unit tests (e.g., testing individual functions)
│   ├── integration/             # Integration tests (e.g., testing API endpoints)
│   └── e2e/                     # End-to-end tests (e.g., testing the entire application flow)
├── public/                      # Static files (e.g., images, documents)
│   └── uploads/                 # Uploaded files (e.g., user profile pictures)
├── .env                         # Environment variables (e.g., database URL, JWT secret)
├── .env.example                 # Example environment variables file (for documentation)
├── .gitignore                   # Files and folders to ignore in Git
├── .eslintrc.js                 # ESLint configuration for code linting
├── .prettierrc                  # Prettier configuration for code formatting
├── package.json                 # Project dependencies and scripts
├── README.md                    # Project documentation
└── Dockerfile                   # Docker configuration for containerization

Usage

  1. Generate the Boilerplate: Run the following command to create a new project:

    npx setup-mern my-new-project
  2. Navigate to the Project Folder:

    cd my-new-project
  3. Install Dependencies:

    npm install
  4. Start the Development Server:

    npm run dev

Documentation

For detailed documentation, visit setup-mern-docs.


License

Licensed under the MIT License. Copyright © 2025 Muhammad Haider.