Create production-ready backend projects with Bend
npm install create-bend
bash
npm create bend@latest
`
$3
`bash
npm create bend@latest my-backend
`
$3
`bash
pnpm
pnpm create bend
yarn
yarn create bend
bun
bunx create-bend
`
What You Get
Every project includes:
$3
- ✅ helmet() - Security HTTP headers
- ✅ cors() - Cross-origin resource sharing
- ✅ rateLimit() - DDoS protection (100 req/15min)
- ✅ hpp() - HTTP parameter pollution prevention
- ✅ compression() - Response compression
- ✅ Body limits - Memory exhaustion prevention
$3
- ✅ Winston - Enterprise-grade logging
- ✅ Daily rotation - 30-day retention, 20MB max size
- ✅ Structured logs - JSON format (error, combined, exceptions)
- ✅ HTTP logging - Morgan middleware integration
- ✅ Production-ready - Compatible with DataDog, Splunk, ELK
$3
- ✅ Async error handling - No try/catch needed
- ✅ Centralized errors - Single error middleware
- ✅ Graceful shutdown - Proper cleanup on exit
- ✅ Unhandled rejections - No silent crashes
Stack Options
$3
- Runtimes: Node.js or Bun (auto-detected)
- Languages: TypeScript or JavaScript
- Frameworks: Express or Fastify
- ORMs: Mongoose (MongoDB) or Prisma (SQL)
Total: 8 template combinations - All fully tested and production-ready.
How It Works
create-bend is a lightweight initializer that:
1. Detects your runtime (Node.js or Bun)
2. Detects your package manager (npm, pnpm, yarn, or bun)
3. Downloads bend-core
4. Runs the interactive setup
5. Generates your project
No installation required - Everything works via npm create.
Interactive Setup
Running npm create bend starts an interactive CLI:
`
? Project name: my-backend
? Select a language: TypeScript
? Select a framework: Express
? Select an ORM: Mongoose
? Install dependencies? Yes
✓ Project created at ./my-backend
✓ Dependencies installed
✓ Ready to start!
cd my-backend
npm run dev
`
Generated Project
`
my-backend/
├── src/
│ ├── config/
│ │ ├── database.ts # DB connection
│ │ └── logger.ts # Winston config
│ ├── controllers/ # Route controllers
│ ├── models/ # Database models
│ │ └── User.model.ts # Example model
│ ├── routes/ # API routes
│ │ └── health.routes.ts
│ ├── services/ # Business logic
│ ├── middlewares/ # Custom middlewares
│ ├── utils/ # Utilities
│ ├── app.ts # App + security
│ └── server.ts # Entry point
├── logs/ # Auto-generated
├── .env # Environment vars
├── .gitignore
├── package.json
├── tsconfig.json # (if TypeScript)
└── README.md
`
Example: What Your API Includes
`typescript
// app.ts - Already configured for you!
import helmet from 'helmet';
import cors from 'cors';
import rateLimit from 'express-rate-limit';
import hpp from 'hpp';
const app = express();
// Security
app.use(helmet());
app.use(cors());
app.use(hpp());
// Rate limiting
const limiter = rateLimit({
windowMs: 15 60 1000,
max: 100,
});
app.use('/api/', limiter);
// ... and more!
`
Environment Variables
Configure via .env:
`bash
Server
PORT=3000
NODE_ENV=development
Database (MongoDB)
MONGODB_URI=mongodb://localhost:27017/myapp
Database (Prisma - PostgreSQL)
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
Security
CORS_ORIGIN=https://yourdomain.com
Logging
LOG_LEVEL=info
`
Commands
Run these in your generated project:
`bash
Development
npm run dev # Start with auto-reload
npm start # Production mode
Build (TypeScript)
npm run build # Compile to dist/
Linting
npm run lint # Check code quality
npm run lint:fix # Auto-fix issues
Formatting
npm run format # Format code
`
Package Comparison
Bend offers three packages for different use cases:
$3
Best for: End users creating new projects
`bash
npm create bend@latest
`
What it does: Lightweight initializer that downloads and runs bend-core
$3
Best for: Direct usage or programmatic access
`bash
npx bend-core
`
What it does: Core library with all templates and scaffolding logic
$3
Best for: Users who prefer global installation
`bash
npm install -g bendjs
bend
`
What it does: Global CLI wrapper around bend-core
Why create-bend?
- Zero installation: Works via npm create
- Always latest: Downloads current version of bend-core
- Standard pattern: Follows npm init/create conventions
- Package manager friendly: Works with npm, pnpm, yarn, bun
FAQ
$3
No! Use npm create bend to run it directly without installation.
$3
create-bend is a thin wrapper that downloads and runs bend-core. Use create-bend via npm create bend.
$3
Yes! Bend fully supports Bun runtime. Use bunx create-bend`.