Stop Wasting Time on Boilerplate: Generate Production-Ready Node.js Apps in 1 Minute
Hi everyone! 👋
As Node.js developers, we've all been there. You have a great idea for a new project, but before you can write a single line of business logic, you have to spend hours setting up the foundation.
You know the drill:
- Copy-paste a folder structure from an old project.
- Configure
ESLint,Prettier, andTypeScript. - Set up Docker and
docker-compose. - Wire up the database connection.
- Build the base Controller/Service layers.
It’s not hard, but it’s tedious. It’s called "Boilerplate Fatigue," and it kills momentum.
To solve this, I built a CLI tool called nodejs-quickstart-structure.
The goal is simple: Run one command, and get a professional, industry-standard Node.js project ready for code.
Meet nodejs-quickstart-structure
There are plenty of generators out there, but I often find them either too simple (just a basic Express app) or too opinionated (forcing a specific framework or folder structure I don't like).
nodejs-quickstart-structure is designed to balance flexibility with professional standards.
Key Features ✨
- Architecture Agnostic:
- MVC: Perfect for small-to-medium projects that need to move fast.
- Clean Architecture: Ideal for enterprise applications and microservices requiring strict separation of concerns (Dependency Rule).
- Language Support: First-class support for both JavaScript and TypeScript.
- Database Integration: Auto-configured connections for MongoDB, MySQL, or PostgreSQL.
- Microservices Ready: Optional Kafka integration for event-driven architectures.
- Caching: Built-in Redis support for high-performance data caching.
- DevOps Friendly:
- Generates a complete
docker-compose.ymlfor DB, Redis, Kafka, and Zookeeper. - Optimized Multi-Stage Dockerfile for small, secure production images.
- CI/CD templates included for GitHub Actions and Jenkins.
- Generates a complete
- Code Quality: Pre-configured with
ESLint,Prettier,Husky, andLint-staged. - Professional Logging:
Winston+Morgansetup for structured logging.
Installation & Usage
It's published on npm, so you can install it globally:
npm install -g nodejs-quickstart-structure
Create a New Project
Navigate to your workspace and run:
nodejs-quickstart init
The CLI will ask you a few interactive questions to customize your stack:
- Project Name: e.g.,
my-awesome-app
- Language:
TypeScript/JavaScript
- Architecture:
Clean Architecture/MVC
- Database:
PostgreSQL/MySQL/MongoDB
- Caching:
Redis/None
- Communication:
REST APIs/Kafka
And... BOOM! 💥
In seconds, you have a fully scaffolded project structure:
my-awesome-app/
├── src/
│ ├── config/ # Environment variables, db config
│ ├── controllers/ # (MVC) or interfaces/controllers (Clean Arch)
│ ├── routes/ # (MVC) or interfaces/routes (Clean Arch)
│ ├── usecases/ # (Clean Arch) Application Business Rules
│ ├── domain/ # (Clean Arch) Enterprise Business Rules
│ ├── infrastructure/ # (Clean Arch) Database repositories, external services
│ └── index.ts # Entry point
├── docker-compose.yml # Fully configured services
├── .eslintrc.json
├── package.json
└── ...
Massive Customizability
The tool supports over 112 different configuration combinations, all rigorously tested on Windows and Linux.
For example, if you choose TypeScript + Clean Architecture + PostgreSQL + Kafka + Redis, the tool will:
- Generate a Clean Architecture folder structure (Entities, Use Cases, Interfaces).
- Install the
pgdriver and configure the connection. - Set up
kafkajsfor messaging. - Configure the
redisclient. - Create
utilswith migration scripts. - Generate sample User CRUD code so you can see exactly how data flows through the layers.
Contribution
This project is Open Source (ISC License). I’d love for you to try it out, break it, report bugs, or contribute new features (NestJS support, anyone?).
- GitHub: https://github.com/paudang/nodejs-quickstart-structure
- NPM: https://www.npmjs.com/package/nodejs-quickstart-structure
If you find this tool useful, please give it a ⭐️ on GitHub! It really helps keep the motivation high.
