A scalable microservices architecture built with Go, featuring hot-reload development and orchestrated service management.
This project consists of four core microservices:
- Gateway Service - API gateway and request routing
- Order Service - Order management and processing
- Product Service - Product catalog and inventory
- Notification Service - Event-driven notifications
- Go 1.21 or higher
- Docker & Docker Compose
- Make
- Homebrew (for macOS)
-
Clone the repository
git clone <repository-url> cd kc-go-microservices
-
Install dependencies
make install-deps
-
Configure your shell (one-time only)
make setup-path source ~/.zshrc # or source ~/.bashrc for bash
-
Run setup
make setup
-
Start services
make start
Or run everything in one command:
make dev
| Command | Description |
|---|---|
make help |
Show all available commands |
make setup |
Complete project setup (configs, Docker, deps check) |
make dev |
Full setup + start services (one command) |
make start |
Start all services with live logs |
make stop |
Stop all running services |
make install-deps |
Install air and overmind |
make setup-air |
Create Air config files for hot-reload |
make setup-procfile |
Generate Procfile for Overmind |
make docker-up |
Start Docker containers |
make docker-down |
Stop Docker containers |
make clean |
Clean temporary files and stop everything |
# Start your day
make start
# Code your changes...
# Air automatically reloads services on file changes
# Stop services (Ctrl+C or in another terminal)
make stopServices are located in the services/ directory:
services/
├── gateway-service/
├── order-service/
├── product-service/
└── notification-service/
Each service has:
main.go- Service entry point.air.toml- Hot-reload configurationtmp/- Build artifacts (gitignored)
- Language: Go
- Service Orchestration: Overmind
- Hot Reload: Air
- Containerization: Docker & Docker Compose
- Build Tool: Make
.
├── services/
│ ├── gateway-service/
│ │ ├── main.go
│ │ ├── .air.toml
│ │ └── tmp/
│ ├── order-service/
│ ├── product-service/
│ └── notification-service/
├── docker-compose.yml
├── Procfile
├── Makefile
└── README.md
The docker-compose.yml includes supporting services like:
- Database (PostgreSQL/MySQL)
- Message Queue (RabbitMQ/Kafka)
- Cache (Redis)
- etc.
Start Docker services separately:
make docker-upStop Docker services:
make docker-downAir watches for file changes and automatically rebuilds and restarts services. Configuration is in each service's .air.toml file.
What triggers a reload:
- Changes to
.gofiles - New Go files added
What doesn't trigger a reload:
- Changes in
tmp/directory - Changes in
vendor/directory
Remove all temporary files and stop services:
make cleanThis will:
- Remove all
tmp/directories - Delete the Procfile
- Stop Docker containers
-
Check if all dependencies are installed:
make check-deps
-
Ensure Docker is running:
docker ps
-
Check if ports are already in use
Make sure Go bin is in your PATH:
echo $PATH | grep go/binIf not, run:
make setup-path
source ~/.zshrcEnsure Docker doesn't require sudo:
sudo usermod -aG docker $USER
newgrp dockerEach service can be configured via:
- Environment variables in
docker-compose.yml - Config files in each service directory
- Command-line flags in
Procfile
- Create a feature branch
- Make your changes
- Test locally with
make start - Submit a pull request
[Your License Here]
[Your Team Information]
Need help? Run make help to see all available commands.