Production APIs
in seconds

Generate a fully scaffolded Node.js backend. Choose your language, architecture, and features. Deploy immediately.

View on GitHub

NPX CLI

Last 30 days downloads: loading…

View on npm

Why Backend Template?

Save Hours

Start with production code, not boilerplate. Focus on business logic.

Best Practices

Built by experienced developers. Error handling, logging, security included.

📈

Scalable

Monolith or microservices. Grow from MVP to production without rebuilding.

Built for Developers

Language Choice

TypeScript (default) or JavaScript templates

Authentication (optional)

JWT + MongoDB when enabled; off means no DB wiring

Zero Config CLI

Args support mono/micro; prompts only what is needed

Microservices Ready

Gateway + health; Docker or PM2

Middleware Picks

CORS, Helmet, Rate Limit, Morgan

Add Services Later

Re-run CLI; gateway/routes update automatically

How the Backend Template CLI Works

Guided, production-ready scaffolding

The CLI asks only what it needs, generates just what you chose, and keeps docs in sync with your answers—no bloat, no mismatched commands.

1) Start the CLI

Zero-config

npx @ifecodes/backend-template my-project

Optional shortcuts:

npx @ifecodes/backend-template my-project mono

npx @ifecodes/backend-template my-project micro

2) Interactive workflow

Project name

From args or prompt; skipped when adding a service inside /services

Language

TypeScript (default) or JavaScript templates

Metadata (optional)

Description, author, keywords → package.json & README

Architecture

Monolith or Microservice (or inferred from args like mono/micro)

Mode (micro only)

Docker (compose + Dockerfiles) or PM2 (no Docker)

Features

CORS, Rate Limit, Helmet, Morgan (multiselect)

Authentication

Toggle JWT + MongoDB; hasher prompt follows (bcrypt/argon2)

Adding a service?

If /services exists, prompts for service name + per-service features + auth + hasher

3) Architecture-specific behavior

Monolith

  • • Single Express app with versioned modules
  • • Optional auth & middleware
  • • Ready-to-run project

Microservice

  • • API Gateway + services + shared utils
  • • Choose Docker (compose) or PM2
  • • Health service always included; optional auth service

Authentication (optional)

No auth → no DB wiring, no JWT logic, cleaner output.

Auth on → JWT auth, MongoDB wiring, auth routes/controllers.

Hasher choice: bcrypt (Windows-friendly) or argon2 (macOS/Linux recommended). Only one is installed.

Features (pick any)

CORS • Helmet • Rate Limiter • Morgan logging

Only selected middleware and dependencies are added.

4) Dynamic outputs

  • • README is generated to match language, architecture, auth, and deploy mode.
  • • JS projects contain no TS files or configs; TS projects include `tsconfig` and typed files.
  • • Docker mode adds `docker-compose.yml` and per-service Dockerfiles; PM2 mode adds `pm2.config.js`.
  • • Re-running in a microservice workspace switches to “add service” mode and wires the gateway automatically.

Summary Matrix

JavaScript

Pure JS output, no TS configs

TypeScript

Full typings + tooling

Monolith

Single Express app

Microservice

Gateway + services

Auth OFF

No DB, no JWT

Auth ON

JWT + MongoDB

bcrypt

Windows-friendly hashing

argon2

Stronger hashing

Docker

Containerized services

PM2

Process-managed deploy

No features

Minimal API

Any features

Only chosen middleware

Docs

Everything you need: install command, options, and usage examples.

Quick anchors

Install

Run it instantly with npx (recommended).

npx @ifecodes/backend-template@latest my-project

Options

Shortcuts for architecture (the CLI can also infer this from prompts).

npx @ifecodes/backend-template my-project mono

npx @ifecodes/backend-template my-project micro

Full docs

Read the complete README with all prompts, generated structure, and notes.

Requirements

  • • Works on Windows, macOS, and Linux.
  • • MongoDB is only required when Authentication is enabled.
  • • Docker is only required when you choose Docker mode for microservices.

Examples

Example layouts produced by the CLI when authentication is disabled (no auth).

Microservice (no auth)

Workspace
my-workspace/ services/ gateway/ health-service/ shared/ config/ utils/ package.json README.md .env.example

Notes:

  • • Docker mode adds docker-compose.yml at the repo root.
  • • PM2 (nodocker) adds pm2.config.js at the repo root.
  • • If auth is enabled, auth-service/ appears under services/.

Microservice (Docker mode)

docker-compose
my-workspace/ services/ gateway/ health-service/ shared/ config/ utils/ docker-compose.yml package.json README.md .env.example

Microservice (PM2 mode)

nodocker
my-workspace/ services/ gateway/ health-service/ shared/ config/ utils/ pm2.config.js package.json README.md .env.example

Monolith (no auth)

Single repo
my-monolith-app/ src/ config/ middlewares/ modules/ v1/ health/ utils/ app.ts (or app.js) routes.ts (or routes.js) server.ts (or server.js) package.json README.md .env.example

Notes:

  • • If auth is enabled, the monolith includes src/modules/v1/auth/ and src/models/.
  • • Tooling (ESLint, Prettier, Husky) is configured at the repository root.
  • • The root README.md is generated and updated when you add services in microservice mode.

FAQ

Common questions about platform support, requirements, and how the generator behaves.

Does it work on Windows?+

Yes. The CLI is designed to work on Windows, macOS, and Linux. For password hashing, bcrypt is the most Windows-friendly default.

What Node.js version do I need?+

Use a modern LTS Node.js version. If you run into any install/runtime issues, update Node first (LTS) before anything else.

Do I need MongoDB?+

Only if you enable Authentication. If auth is OFF, the output stays clean: no DB wiring, no JWT logic, no auth service.

Docker vs PM2 — when should I choose each?+

Docker mode generates compose + Dockerfiles for containerized services. PM2 mode skips Docker and sets up process-managed deployment. Choose based on your deployment environment.

How does “add service” work in microservices?+

When the CLI detects an existing microservice workspace (a /services folder), it switches into add-service mode: it prompts for a new service name and optional features/auth, then updates gateway routing automatically.

Can I generate JavaScript instead of TypeScript?+

Yes. You can pick TypeScript (default) or JavaScript. The output matches your selection (no TS config in JS projects).

What middleware/features can I include?+

You can select middleware like CORS, Helmet, Rate Limiting, and Morgan. Only what you select gets added to dependencies and wired into the app.

Choose Your Path

Modern Stack

Node.js
Express.js
TypeScript
JavaScript
MongoDB
JWT
Docker (microservices)
PM2 (microservices)
Helmet
CORS
Rate Limiting
Morgan

Ready to Build?

Open source, free, and made for developers by developers.

Star on GitHub