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

backend-architecture-generator

v1.0.2

Published

Generate production-ready Node.js backend architectures - choose between monolithic or microservices patterns with API Gateway, Docker, databases, and more

Readme

Node Backend Generator 🚀

npm version npm downloads License: MIT Node.js Version

A powerful CLI tool to generate professional, production-ready Node.js backend templates in seconds.
Choose your database, architecture, and features — and get a complete backend with best practices baked in.


⚡ Quick Overview

Node Backend Generator helps you generate production-ready Node.js backends in seconds.
Choose between Monolithic or Microservices architecture, with built-in features like authentication, Docker setup, Swagger docs, file uploads, and more.


✨ Key Features

  • 🏗️ Architecture Choice – Monolithic or Microservices
  • 🗄️ Multiple Databases – MongoDB, PostgreSQL, MySQL, or DB-less
  • 🔐 Built-in Auth – JWT, bcrypt, refresh tokens
  • 🐳 Docker Ready – Full containerization support
  • 📚 Auto Documentation – Swagger/OpenAPI
  • 🛡️ Security – Helmet, CORS, rate limiting
  • 📧 Email Service – Nodemailer with templates
  • 📁 File Upload – Multer with validation
  • Modern JavaScript – ES Modules & CommonJS support
  • 🎯 Production Ready – Error handling, logging, environment config

🚀 Quick Start

Using npx (Recommended — No Installation Needed)

npx node-backend-generator@latest

Global Installation

npm install -g node-backend-generator
create-node-backend

Local Installation

npm install node-backend-generator
npx create-node-backend

🎯 Interactive Setup

The CLI guides you through:

? Project name: my-api
? Architecture:
❯ Monolithic
  Microservices

? Database:
❯ MongoDB (Mongoose)
  PostgreSQL (Prisma)
  MySQL (Sequelize)
  None

? Features:
◉ Authentication | ◉ Docker | ◉ API Docs
◉ File Upload   | ◉ Email  | ◉ Rate Limiting

📁 Generated Project Structure

my-api/
├── src/
│   ├── controllers/   # Business logic
│   ├── models/        # Database models
│   ├── routes/        # API endpoints
│   ├── middlewares/   # Auth, validation
│   └── config/        # DB, environment
├── docker-compose.yml # Full stack setup
├── package.json       # Scripts & dependencies
└── .env               # Environment config

🔧 Get Started

cd my-api
npm install
cp .env.example .env
npm run dev

Visit: http://localhost:3000/api-docs for API documentation.


🐳 Docker Setup

# Start everything
docker-compose up -d

# Scale microservices
docker-compose up -d --scale auth-service=2 --scale user-service=2

📚 API Examples

🔐 Authentication

# Register
curl -X POST http://localhost:3000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"name":"John","email":"[email protected]","password":"secret"}'

# Login
curl -X POST http://localhost:3000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","password":"secret"}'

📁 File Upload

const formData = new FormData();
formData.append('file', file);

fetch('/api/upload/single', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer token' },
  body: formData
});

🛠️ Customization

  • Add Routes: Create under src/routes/ + logic in src/controllers/
  • Add Models: Define in src/models/
  • Add Middleware: Add to src/middlewares/ and import globally or per-route

🤝 Support


Start building your next great API in seconds! 🎉

Generated with ❤️ by Node Backend Generator


🧩 Full Feature Reference (Detailed Section)

For users who want the complete setup details, here’s the expanded guide below ⬇️


🧭 Usage

npx node-backend-generator@latest

Follow the setup prompts, select your preferences, and your backend will be ready instantly.


🏗️ Example Structure (Detailed)

my-awesome-api/
├── server.js
├── package.json
├── .env
├── .env.example
├── .gitignore
├── Dockerfile
├── docker-compose.yml
├── src/
│   ├── config/
│   ├── controllers/
│   ├── models/
│   ├── routes/
│   ├── middlewares/
│   ├── services/
│   └── utils/
├── uploads/
└── tests/

🧰 Available Scripts

npm start          # Start production server
npm run dev        # Development with nodemon
npm test           # Run tests
npm run lint       # Lint code
npm run lint:fix   # Auto-fix lint issues

🔐 Authentication Usage

POST /api/auth/register
{
  "name": "John Doe",
  "email": "[email protected]",
  "password": "securepassword"
}
POST /api/auth/login
{
  "email": "[email protected]",
  "password": "securepassword"
}

Add JWT token:

Authorization: Bearer <your_jwt_token_here>

🧾 Environment Variables

# Server
NODE_ENV=development
PORT=3000

# Database
MONGODB_URI=mongodb://localhost:27017/your-db
DATABASE_URL="mysql://root:password@localhost:3306/your-db"

# JWT
JWT_SECRET=your_super_secret_key
JWT_EXPIRES_IN=7d

# Email
SMTP_HOST=your-smtp-host
SMTP_PORT=587
[email protected]
SMTP_PASS=your-password

🧱 Database Setup

MongoDB (Mongoose)

  • Update MONGODB_URI in .env
  • Done.

MySQL / PostgreSQL (Sequelize)

  • Update .env credentials.

Prisma

npx prisma generate
npx prisma db push

🐳 Docker Support (Detailed)

docker-compose up -d
docker build -t my-backend .
docker run -p 3000:3000 my-backend

📧 Email Example

POST /api/email/test
{
  "email": "[email protected]"
}

🛠️ Extend Functionality

  • Controllers: Add in src/controllers
  • Routes: Add in src/routes
  • Middlewares: Add in src/middlewares

📄 License

MIT License — see LICENSE


Happy Coding!
Built with ❤️ by Trina Dasgupta