setup-docker-node
v1.0.4
Published
Ready-made Docker setup for Node.js (Postgres / MySQL / Redis)
Readme
setup-docker-node
A simple CLI to generate ready-made Docker setup for Node.js backends.
Stop wasting time writing Dockerfiles and docker-compose manually.
This tool gives you production-ready templates in seconds.
✨ Features
- 🚀 Node.js + TypeScript ready
- 🗄️ PostgreSQL or MySQL database support
- ⚡ Redis caching (optional)
- 🛠️ Express or Fastify framework choice
- 🐳 Dockerfile (development + production)
- 🔄 docker-compose for local development
- 📝 Clean
.env.exampleconfiguration - 🏭 Industry best practices built-in
- 💻 Cross-platform: Windows, macOS, Linux
🚀 Quick Start
Global Usage (Recommended)
npx setup-docker-node
Local Installation
npm install -D setup-docker-node npx setup-docker-node
Skip Prompts (Use Defaults)
npx setup-docker-node --yes
📋 Usage
Run the CLI and follow the interactive prompts:
npx setup-docker-node
You'll be asked to configure:
- Project name (default:
my-app) - Database: PostgreSQL or MySQL
- Redis: Include Redis caching? (default: yes)
- Framework: Express or Fastify
🏗️ Generated Project Structure
my-app/ ├── src/ │ ├── index.ts │ └── routes/ ├── Dockerfile ├── Dockerfile.prod ├── docker-compose.dev.yml ├── .env.example ├── package.json ├── tsconfig.json └── README.md
🎯 After Setup
Once your project is generated:
cd my-app npm install docker compose -f docker-compose.dev.yml up
Your Node.js application will be running with:
- Database (PostgreSQL/MySQL)
- Redis (if enabled)
- Hot reload for development
- Environment variables configured
🛠️ Configuration Options
| Option | Choices | Default |
| ------------ | --------------------- | ---------- |
| Database | PostgreSQL, MySQL | PostgreSQL |
| Framework | Express, Fastify | Express |
| Redis | Yes, No | Yes |
| Project Name | Any valid folder name | my-app |
🐳 Docker Features
- Multi-stage builds for optimized production images
- Development environment with hot reload
- Environment variables management
- Database migrations support
- Health checks for services
📦 Templates
This CLI generates templates with:
- TypeScript configuration
- ESLint and Prettier setup
- Database connection management
- API routes structure
- Error handling middleware
- Logging configuration
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
MIT © Shivang Rawat
