create-backend-api
v0.2.1
Published
A CLI tool to generate lean Node.js backend scaffolds with TypeScript, Express/Fastify, and TypeORM/Prisma
Maintainers
Readme
create-backend-api
A CLI tool to generate lean Node.js backend scaffolds with TypeScript — entry point, database infra, and optional Docker. You own the architecture from there.
Features
- Quick Setup - Generate a minimal backend project in seconds
- Lean Scaffold - Entry point + DB config only; no unused boilerplate
- Multiple Stacks - Express/Fastify + TypeORM/Prisma + PostgreSQL
- Docker Ready - Optional Docker and Docker Compose configuration
- Tooling Ready - Pre-configured with ESLint, Prettier, and TypeScript
- Type Safe - Full TypeScript support with proper types
Supported Stacks
| Framework | ORM | Database | Status | | --------- | ------- | ---------- | ------ | | Express | TypeORM | PostgreSQL | ✅ | | Express | Prisma | PostgreSQL | ✅ | | Fastify | TypeORM | PostgreSQL | ✅ |
Quick Start
The Easiest Way (No Installation Required)
npx create-backend-api createThe CLI will guide you through project setup and generate a lean backend scaffold.
Alternative: Install Globally
npm install -g create-backend-api
create-backend-api createWhat Happens Next?
The CLI will interactively ask you:
- Project name - e.g.,
my-api - Description - Brief project description
- Version - Project version (default:
1.0.0) - Target directory - Where to create the project
- Node.js version - For Docker (default:
22) - Docker? - Include Docker configuration (Yes/No)
- Framework - Express or Fastify
- ORM - TypeORM or Prisma
- Database - PostgreSQL
Example
$ create-backend-api create
ℹ Welcome to create-backend-api!
ℹ Let's create your new backend project.
✔ Project name: my-api
✔ Project description: A REST API for my application
✔ Project version: 1.0.0
✔ Target directory: ./my-api
✔ Node.js version (optional): 22
✔ Include Docker configuration? Yes
✔ Select a framework: Express
✔ Select an ORM: TypeORM
✔ Select a database: PostgreSQL
✓ Project generated successfully!
✓ Project created at: /path/to/my-api
ℹ Next steps:
cd my-api
npm install
npm run devGenerated Project Structure
Projects get a minimal scaffold — bootstrap, DB infra, and optional Docker:
my-api/
├── src/
│ ├── index.ts # App bootstrap + GET /health
│ └── infrastructure/
│ └── config/
│ ├── database.ts # TypeORM DataSource or PrismaClient
│ └── data-source.ts # TypeORM CLI (TypeORM stacks)
│
├── prisma/schema.prisma # Prisma stacks only (no sample models)
├── docker-compose.yml # Optional
├── Dockerfile # Optional
├── .env.example
├── package.json
├── tsconfig.json
└── README.mdWhat's Included
Every generated project comes with:
- TypeScript - Full type safety
- ESLint + Prettier - Code quality and formatting
- Health Check -
GET /health - Database Setup - Pre-configured TypeORM or Prisma connection
- Docker Support - Optional Docker configuration
- No unused boilerplate - Add your own architecture as you grow
Documentation
Development
Prerequisites
- Node.js >= 22.12.0
- npm or yarn
Setup
git clone https://github.com/HSThzz/BackEnd-Factory.git
cd BackEnd-Factory
npm install
npm run buildScripts
npm run build- Compile TypeScript to JavaScriptnpm run dev- Watch mode for developmentnpm run dev:cli- Run CLI in development modenpm run lint- Run ESLintnpm run format- Format code with Prettiernpm run format:check- Check code formattingnpm run test- Run tests
Contributing
Contributions are welcome! Please read our Contributing Guide for details.
License
MIT License - see LICENSE file for details.
Acknowledgments
- Built with Commander.js
- Templates powered by Handlebars
- Interactive prompts with Inquirer
