Skip to main content

Introduction

xpress-generator is a professional CLI tool that scaffolds a complete, production-ready Express.js backend in one command.

Instead of spending hours wiring up authentication, error handling, database connections, migrations, Docker, testing, and linting from scratch β€” xpress-generator generates a well-structured project with all of that already configured, so you can start building features immediately.

npx xpress-generator create MyApp

Philosophy​

xpress-generator is built around three core ideas:

1. Zero config, full setup​

Answer a few questions and get a project that actually works β€” including auth routes, a database connection, migrations, Docker, middleware, and tests.

2. Opinionated but flexible​

The generated project follows professional conventions (clean module architecture, separate server.js from app.js, service layer, centralized error handling) but every file is yours to modify.

3. Professional from the start​

Every project is generated with testing, migrations, Docker, linting, and pre-commit hooks already configured. No shortcuts.


What gets generated​

When you run npx xpress-generator create MyApp and answer the prompts, you get:

CategoryWhat's included
ArchitectureClean module structure β€” src/modules/, src/shared/, src/middleware/
AuthJWT login/logout, refresh tokens (httpOnly cookie), verifyToken, requireRole, rate limiting
Error handlingAppError class, global errorHandler middleware, catchAsync wrapper
ValidationZod schema + reusable validate middleware
DatabaseConfig file + model + service for your chosen DB
MigrationsSequelize CLI (MySQL/PostgreSQL) or custom SQL runner (SQL Server)
DockerMulti-stage Dockerfile + docker-compose.yml tailored to your database
TestingJest + supertest, tests/setup.js, example integration test, 70% coverage threshold
LintingESLint config (+ @typescript-eslint for TS projects)
Pre-commitHusky + lint-staged auto-configured and ready
TypeScriptFull .ts templates, tsconfig.json, ts-node, ts-jest, all @types/*

Supported databases​

DatabaseDriver / ORMMigrations
MongoDBMongooseβ€” (schema-less)
MySQLSequelize + mysql2Sequelize CLI
PostgreSQLSequelize + pgSequelize CLI
SQL ServermssqlCustom SQL runner

CLI at a glance​

# Create a new project
npx xpress-generator create [name]

# Generate a full CRUD module (model + service + controller + routes + schema)
npx xpress-generator generate:model <ModelName>
npx xpress-generator g:model <ModelName> # alias

# Generate a custom middleware
npx xpress-generator generate:middleware <name>
npx xpress-generator g:middleware <name> # alias
Ready to dive in?

Head to Getting Started to create your first project in under 2 minutes.