DEV Community

Cover image for How I Built a Node.js Generator with 1,680+ Combinations, Clean Architecture or MVC (Kafka)
Pau Dang
Pau Dang

Posted on

How I Built a Node.js Generator with 1,680+ Combinations, Clean Architecture or MVC (Kafka)

Hi all,

We’ve all been there: starting a new Node.js microservice from scratch. You spend 4 hours setting up Express, another 2 hours arguing over folder structure (MVC or Clean Architecture?), 3 hours configuring Prisma or Mongoose, and half a day trying to get a Kafka KRaft container to talk to your local app.

By the time you're ready to write your first line of business logic, you're already exhausted.

I decided to solve this once and for all. I built nodejs-quickstart-structure—a CLI that doesn't just give you a "hello world," but scaffolds a production-ready engine tailored to your exact needs.

The Problem: The "Boilerplate exhaustion"

Most generators give you a fixed stack. But in the real world, requirements vary:

  • "This needs to be a simple MVC app."
  • "This needs to be a Clean Architecture domain-driven service."
  • "We need GraphQL, not REST."
  • "We need Kafka for event-driven messaging."

The Solution: 1,680+ Scenarios in One CLI

The core of this tool is its flexibility. By combining different technologies, it supports over 1,680 unique project combinations:

  • Languages: TypeScript (Recommended) / JavaScript.
  • Architectures: MVC or Clean Architecture.
  • Databases: MySQL, PostgreSQL, MongoDB, or None.
  • Communications: REST APIs, GraphQL, or Kafka (Event-Driven).
  • Caching: Redis or Memory Cache.
  • Security: Hardened with Helmet, HPP, and automated Snyk/SonarCloud configs.
  • CI/CD: Ready-to-use workflows for GitHub Actions, GitLab CI, or Jenkins.

Why "Clean Architecture"?

For many projects, MVC starts fast but becomes a nightmare to test. I’ve implemented a robust Clean Architecture template where:

  1. Domain: Pure business logic (Entities/Use Cases).
  2. Infrastructure: Database, Messaging (Kafka Client), Caching.
  3. Interfaces: Controllers, Express Routes, GraphQL Resolvers.

This separation ensures your business logic doesn't care if you're using MongoDB or PostgreSQL.

AI-Native: Coding in 2026

I realized that if the folder structure is standard, AI tools (like Cursor, ChatGPT, or Gemini) can understand the codebase 10x faster.
Every project generated includes:

  • .cursorrules: Pre-configured rules so Cursor knows exactly how to add new features following your chosen architecture.
  • prompts/: A library of "Agent Skills" to help you generate Use Cases or Repositories without breaking patterns.

Try it out

You don't even need to install it globally. Just run:

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

The CLI will walk you through the setup. Within seconds, you'll have a project with 80%+ unit test coverage, ESLint/Prettier configured, and a Docker Compose file that actually works.

Checking the official docs:
👉 Official Documentation

Check out the repo and give it a ⭐ if it helps your workflow:
👉 GitHub: paudang/nodejs-quickstart-structure

I'd love to hear your feedback! What's the one thing you always struggle with when starting a new Node project?

Top comments (0)