create-node-express-modular
v1.0.6
Published
A production-ready, modular, and reusable Node.js Express starter package.
Maintainers
Readme
Create Node Express Modular Starter
A CLI tool to generate a production-ready, modular, and reusable Node.js Express starter project for building scalable backend and SaaS applications.
Built with TypeScript, Clean Architecture, and industry best practices.
🚀 Quick Start
Generate a new project in seconds using npx:
npx create-node-express-modular my-app🚀 Features
Modular Architecture
Feature-based modules (Controller, Service, Model, Validation, Interface, Routes).Authentication & Authorization
Secure JWT-based auth (Access & Refresh Tokens) with role-based access control.Strict Validation
End-to-end request validation using Zod (body, query, params).Centralized Error Handling
Global error handler for Zod, Mongoose, and custom App errors.Security First
Helmet, Rate Limiting, CORS configuration, and secure cookies.Database Best Practices
Mongoose with clean schema design, indexing, and connection handling.File Upload Support
Multer + Cloudinary integration for secure media uploads.Logging
Production-ready logging using Winston.Email & OTP Utilities
Built-in helpers for email sending and OTP workflows.Great Developer Experience
ESLint, Prettier, TypeScript types, and clean project structure.
📂 Project Structure
src/
├── config/ # Environment configuration (Zod validated)
├── errors/ # Custom error classes & handlers
├── interface/ # Shared interfaces & types
├── middlewares/ # Auth, validation, error handlers
├── modules/ # Feature modules (Auth, User, etc.)
│ ├── auth/
│ └── user/
├── routes/ # Centralized router
├── utils/ # Shared utilities (JWT, Logger, Mail, etc.)
├── app.ts # Express app setup
└── server.ts # Entry point🛠️ Getting Started (Generated Project)
After running the npx command, follow these steps inside your new project folder:
Install dependencies:
npm installSet up Environment Variables: Copy
.env.exampleto.envand fill in the required values.cp .env.example .env[!NOTE] Make sure to configure
MONGO_URI,ACCESS_TOKEN_SECRET, andREFRESH_TOKEN_SECRET.Run the server:
npm run dev
📜 Scripts
npm run dev: Start development server with hot-reload.npm run build: Compile TypeScript to JavaScript.npm start: Start the production server (after build).npm run lint: Run ESLint.npm run lint:fix: Fix linting errors.npm run format: Format code with Prettier.
🤝 Contributing
Contributions are welcome! If you want to contribute to the CLI tool itself:
- Clone the repository.
- Install dependencies:
npm install. - Use
npm linkto test the CLI locally. - Submit a pull request.
📄 License
This project is licensed under the ISC License.
