Ready-to-use starter for microservices architecture with Docker
This project is a starter for creating web applications with microservices architecture, fully wrapped in Docker containers. Includes API server, frontend application and Nginx Gateway with SSL + HTTP/2 support.
The project consists of three main components:
- Technology: Single Node.js demo server
- Port: ${API_PORT}
- Technology: Vanilla JavaScript + HTML + Nginx (demo app)
- Port: ${FRONT_PORT}
- Static frontend with Nginx
- Integration with API service
- Automatic Docker build
- Technology: Nginx
- Ports: 80 (HTTP), 443 (HTTPS)
- Features:
- HTTP/2 support
- Reverse proxy for API and Frontend
- SSL/TLS termination
- HTTP β HTTPS redirect
- Security (HSTS, XSS Protection)
- Docker and Docker Compose
- Make
- mkcert (for SSL certificate generation)
git clone https://github.com/scott-walker/docker-starter.git
cd docker-starter
cp .env.example .envEdit the .env file:
# Main project settings
PROJECT_NAME=starter
# Gateway settings
GATEWAY_API_HOST=starter-api
GATEWAY_API_PORT=3000
GATEWAY_API_SERVER_NAME=api.host.lc
GATEWAY_FRONT_HOST=starter-front
GATEWAY_FRONT_PORT=3000
GATEWAY_FRONT_SERVER_NAME=host.lc
# API settings
API_PORT=3000
# Frontend settings
FRONT_PORT=3000
FRONT_API_HOST=api.host.lcmake generate-sslmake add-hosts# Build all images
make build
# Start all services
make start| Command | Description |
|---|---|
make build |
Build all Docker images |
make start |
Start all services |
make stop |
Stop all services |
make restart |
Restart all services |
| Command | Description |
|---|---|
make build-gateway |
Build Gateway image |
make build-api |
Build API image |
make build-front |
Build Frontend image |
| Command | Description |
|---|---|
make run-gateway |
Run Gateway container |
make run-api |
Run API container |
make run-front |
Run Frontend container |
| Command | Description |
|---|---|
make generate-ssl |
Generate SSL certificates |
make add-hosts |
Add hosts to /etc/hosts |
make create-network |
Create Docker network |
After startup, services will be available at the following addresses:
- Frontend: ${GATEWAY_FRONT_SERVER_NAME}
- API: ${GATEWAY_API_SERVER_NAME}
The project includes the following security measures:
- SSL/TLS: Automatic HTTP β HTTPS redirect
- HSTS: HTTP Strict Transport Security
- XSS Protection: Protection against cross-site scripting
- Content Security: Protection against MIME-type sniffing
- Frame Options: Protection against clickjacking
This project is licensed under the MIT License - see the LICENSE file for details.
If you have questions or issues: Issue
Created with β€οΈ for quick Docker project startup
