DEV Community

Cover image for Stop Wasting Time on Boilerplate: Generate Production-Ready Node.js Apps in 1 Minute
Pau Dang
Pau Dang

Posted on • Edited on

Stop Wasting Time on Boilerplate: Generate Production-Ready Node.js Apps in 1 Minute

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:

  1. Copy-paste a folder structure from an old project.
  2. Configure ESLint, Prettier, and TypeScript.
  3. Set up Docker and docker-compose.
  4. Wire up the database connection.
  5. 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

Demo

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 or Memory cache support for high-performance data caching.
  • DevOps Friendly:
    • Generates a complete docker-compose.yml for DB, Redis, Kafka, and Zookeeper.
    • Optimized Multi-Stage Dockerfile for small, secure production images.
    • CI/CD templates included for GitHub Actions / Jenkins / Gitlab.
  • Code Quality: Pre-configured with ESLint, Prettier, Husky, and Lint-staged.
  • Professional Logging: Winston + Morgan setup for structured logging.
  • Deployment: Ship confidently with an integrated PM2 Ecosystem Configuration for zero-downtime reloads and robust process management.

Installation & Usage

It's published on npm, so you can install it globally:

npm install -g nodejs-quickstart-structure
Enter fullscreen mode Exit fullscreen mode

Create a New Project

Navigate to your workspace and run:

nodejs-quickstart init
Enter fullscreen mode Exit fullscreen mode

Or

Quick Start

You can run the generator directly without installing it globally:

npx nodejs-quickstart-structure init
Enter fullscreen mode Exit fullscreen mode

The CLI will ask you a few interactive questions to customize your stack:

  1. Project Name: e.g., my-awesome-app
  2. Language: TypeScript / JavaScript
  3. Architecture: Clean Architecture / MVC
  4. Database: PostgreSQL / MySQL / MongoDB
  5. Caching: Redis / Memory cache
  6. Communication: REST APIs / GraphQL / Kafka
  7. CI/CD: GitHub Actions / Jenkins / Gitlab

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
└── ...
Enter fullscreen mode Exit fullscreen mode

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:

  1. Generate a Clean Architecture folder structure (Entities, Use Cases, Interfaces).
  2. Install the pg driver and configure the connection.
  3. Set up kafkajs for messaging.
  4. Configure the redis client.
  5. Create utils with migration scripts.
  6. 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?).

If you find this tool useful, please give it a ⭐️ on GitHub! It really helps keep the motivation high.

πŸš€ Roadmap & Upcoming Features

We are constantly working to improve nodejs-quickstart-structure and make it the most robust boilerplate generator for Node.js.

You can track our current progress, see what features are being worked on, and vote for your favorites on our public Trello board:

πŸ‘‰ View our Public Roadmap on Trello

If you have a feature request or want to contribute, feel free to check the board and open an issue or pull request!

Top comments (0)