sk-nodeexpress is an ultra-fast, zero-config CLI generator that instantly scaffolds production-ready Node.js & TypeScript Express backend REST APIs.
Say goodbye to spending hours writing repetitive Express boilerplate, JWT authentication logic, Zod validation schemas, environment handling, CORS, Helmet security headers, rate limiting, Docker setups, and database connections from scratch!
๐ Featured Article on Dev.to: Stop Writing Express Boilerplate: Build a Production-Ready REST API in Minutes
npx sk-nodeexpress my-app- ๐ Features
- ๐ Comparison Table
- ๐๏ธ Architecture Flow
- ๐ฆ Installation
- โก Quick Start & CLI Flags
- ๐ Project Structure
- ๐ณ Docker Support
- ๐ง Environment Variables
- ๐ Available Scripts
- ๐ API Example
- โ FAQ & Troubleshooting
- ๐บ๏ธ Roadmap
- ๐ค Contributing
- ๐ License
- โก Express Server Core: Pre-configured app & server entry point with clean modular architecture.
- ๐ Dual Language Support: Choose between JavaScript (ES Modules) and TypeScript.
- ๐ก๏ธ Zod Payload Validation: Integrated Zod validation middleware for all authentication endpoints.
- ๐ Pre-built JWT Authentication:
- User Registration (
POST /api/v1/auth/register) - User Login (
POST /api/v1/auth/login) - Forgot & Reset Password Stubs (
POST /api/v1/auth/forgot-password,/reset-password) - Protected User Profile (
GET /api/v1/auth/me) - Password hashing using
bcryptjs - JWT token generation & Verification Middleware
- User Registration (
- ๐ Database Integration: MongoDB setup using
mongoose(User Schema, connection handlers, duplicate key error handling). - ๐ณ Docker Ready: Multi-stage
Dockerfileanddocker-compose.ymlfor instant containerization. - ๐ก๏ธ Production Security & Middlewares:
helmet: Protects HTTP headerscors: Handles cross-origin requestsexpress-rate-limit: Prevents DDoS / Brute-force attacksmorgan: Request loggingcookie-parser: Parses cookies safely- Global Error Handling & 404 Route Catchers
- ๐ฏ Dynamic File Scaffolding: Strips unused files dynamically based on your selections.
| Feature | sk-nodeexpress |
express-generator |
NestJS CLI |
|---|---|---|---|
| TypeScript Native | โ | โ | โ |
| Pre-built JWT Auth | โ | โ | โ |
| Zod Input Validation | โ | โ | Manual |
| Docker & Compose Setup | โ | โ | Manual |
| Security (Helmet/RateLimit) | โ | โ | Manual |
| Setup Time | < 5s | ~30s | ~60s |
| Zero Configuration | โ | โ | โ |
graph TD
Client["๐ HTTP Client / Postman"] --> Router["๐ฃ๏ธ Express Router (/api/v1/auth)"]
Router --> RateLimit["๐ก๏ธ Rate Limiter & Helmet Middleware"]
RateLimit --> ZodVal["Validating Zod Schema Middleware"]
ZodVal --> Controller["๐ฎ Controller Layer (Async Handler Wrapper)"]
Controller --> Model["๐ Mongoose Model / Bcrypt Password Hash"]
Model --> Response["๐ฆ Standardized API Response Helper"]
Response --> Client
No global installation is required! Run directly using npx:
npx sk-nodeexpressOr specify your project name directly:
npx sk-nodeexpress my-express-apinpx sk-nodeexpress my-app# JavaScript + MongoDB + Auth + Docker
npx sk-nodeexpress my-app --yes
# TypeScript + MongoDB + Auth + Docker
npx sk-nodeexpress my-ts-app --ts --auth --docker
# Standalone Express Server without Auth/DB
npx sk-nodeexpress my-minimal-app --js --no-auth --db none --no-docker--ts/--js: Select language template--auth/--no-auth: Include or exclude JWT Authentication--db <type>: Database type (mongodbornone)--docker/--no-docker: Include or exclude Docker & docker-compose--install/--no-install: Control automaticnpm install
my-express-api/
โโโ src/
โ โโโ config/
โ โ โโโ db.js # MongoDB Mongoose Connection
โ โโโ controllers/
โ โ โโโ authController.js# Register, Login, Profile, Password Reset
โ โ โโโ userController.js# User management logic
โ โ โโโ healthController.js # Server healthcheck endpoint
โ โโโ middlewares/
โ โ โโโ authMiddleware.js# JWT Guard & Role verification
โ โ โโโ validate.js # Zod Schema Validator Middleware
โ โ โโโ errorMiddleware.js# Global Error & 404 handler
โ โ โโโ rateLimiter.js # Rate limiting guards
โ โโโ validations/
โ โ โโโ authValidation.js# Zod Validation Schemas
โ โโโ models/
โ โ โโโ User.js # Mongoose User Schema & Bcrypt methods
โ โโโ routes/
โ โ โโโ authRoutes.js # Auth endpoints with Zod Guards
โ โ โโโ userRoutes.js # User endpoints
โ โ โโโ healthRoutes.js # Health endpoint
โ โโโ utils/
โ โ โโโ apiResponse.js # Standardized JSON response wrapper
โ โ โโโ asyncHandler.js # Async Error Handler Wrapper
โ โ โโโ jwt.js # JWT Sign & Verify helpers
โ โโโ app.js # Express application setup
โ โโโ server.js # Server listener
โโโ Dockerfile # Production Docker Container setup
โโโ docker-compose.yml # Express API + MongoDB Services setup
โโโ .env.example # Environment template
โโโ package.json # App dependencies & npm scripts
โโโ README.md # Generated project documentation
To run your API inside a Docker container with MongoDB:
# Build and start containers in detached mode
docker-compose up -d --build
# View container logs
docker-compose logs -f
# Stop containers
docker-compose downPORT=5000
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/my_sknodejs_db
JWT_SECRET=super_secret_jwt_key_change_in_prod
JWT_EXPIRES_IN=7d
CORS_ORIGIN=*POST /api/v1/auth/register
{
"name": "Jane Doe",
"email": "jane@example.com",
"password": "password123"
}POST /api/v1/auth/login
{
"email": "jane@example.com",
"password": "password123"
}Ensure you have created a .env file from .env.example and specified a valid JWT_SECRET.
Ensure MongoDB service is running locally (mongod) or start it via docker-compose up -d mongo.
- v1.1.0: Zod Validation, Async Process Execution, Docker Support, Non-interactive Flags.
- v1.2.0: Swagger OpenAPI documentation endpoint (
/api-docs). - v2.0.0: Prisma ORM Support (PostgreSQL / MySQL).
Please read our Contributing Guide and Code of Conduct before submitting pull requests.
MIT ยฉ Shobhit Kumar


