A comprehensive microservices application built with Go, featuring multiple communication patterns including HTTP, RPC, gRPC, and message queuing with RabbitMQ.
This project demonstrates a complete microservices ecosystem where users interact through a browser with a central Broker Service that orchestrates communication with various specialized microservices. The architecture showcases multiple inter-service communication patterns including HTTP/JSON, RPC, gRPC, and asynchronous messaging via RabbitMQ.
π User (Browser) β Broker Service (Docker) β Microservices
The Broker Service acts as an API Gateway, routing requests to appropriate services using:
- π JSON/HTTP: Direct REST API calls to Auth and Mail services
- β‘ RPC: Traditional Remote Procedure Calls to Logger service
- π gRPC: High-performance Protocol Buffer communication to Logger service
- π¨ RabbitMQ: Asynchronous message queuing to Listener service
- PostgreSQL: User authentication data
- MongoDB: Centralized logging storage
- RabbitMQ: Message queue for asynchronous processing
- MailHog: SMTP testing and email delivery
| Service | Port | Description | Communication |
|---|---|---|---|
| Frontend Service | 8081 | Web interface with HTML templates | HTTP to Broker |
| Broker Service | 8080 | API Gateway and service orchestrator | HTTP, RPC, gRPC, RabbitMQ |
| Authentication Service | 8081 | User authentication and authorization | HTTP, PostgreSQL |
| Logger Service | - | Centralized logging with multiple interfaces | RPC (5001), gRPC (50001), MongoDB |
| Mail Service | 8082 | Email sending service | HTTP, MailHog |
| Listener Service | 8083 | RabbitMQ message consumer | RabbitMQ Consumer |
| Service | Port | Description |
|---|---|---|
| PostgreSQL | 5432 | Database for authentication service |
| MongoDB | 27017 | Database for logging service |
| RabbitMQ | 5672, 15672 | Message queue and management UI |
| MailHog | 1025, 8025 | SMTP testing tool |
- Frontend β Broker Service
- Broker β Authentication Service
- Broker β Mail Service
- Broker β Logger Service (Port 5001)
- Traditional Go net/rpc implementation
- Broker β Logger Service (Port 50001)
- Protocol Buffer based communication
- Broker β RabbitMQ β Listener Service
- Asynchronous message processing
- Event-driven architecture
- Language: Go 1.23+
- Web Framework: Chi Router
- Databases: PostgreSQL, MongoDB
- Message Queue: RabbitMQ
- Communication: HTTP, RPC, gRPC, AMQP
- Containerization: Docker & Docker Compose
- Build Tool: Make
| Command | Description |
|---|---|
make up |
Start all containers in background |
make up_build |
Build and start all containers |
make down |
Stop all containers |
make build_broker |
Build broker service binary |
make build_auth |
Build authentication service binary |
make build_logger |
Build logger service binary |
make build_mail |
Build mail service binary |
make build_listener |
Build listener service binary |
make build_front |
Build frontend service binary |
make start |
Start frontend in development mode |
make stop |
Stop frontend development server |
Frontend Service (http://localhost:8081)
- GET /: Main application interface
Broker Service (http://localhost:8080)
- POST /: Main broker endpoint
- POST /handle: Route requests to appropriate services
- POST /log-grpc: Test gRPC logging
Authentication Service (http://localhost:8081)
- POST /authenticate: User login
- Validates credentials against PostgreSQL database
Mail Service (http://localhost:8082)
- POST /send: Send email via MailHog
RabbitMQ Management (http://localhost:15672)
- Username: guest
- Password: guest
MailHog UI (http://localhost:8025)
- Email testing interface
Frontend β Broker Service β Authentication Service β PostgreSQL
Frontend β Broker Service β Logger Service (HTTP)
Frontend β Broker Service β Logger Service (RPC)
Frontend β Broker Service β Logger Service (gRPC)
Frontend β Broker Service β RabbitMQ β Listener Service β Logger Service
Frontend β Broker Service β Mail Service β MailHog
- Database: users
- Table: users (id, email, password_hash, created_at, updated_at)
- Database: logs
- Collection: logs (name, data, created_at)
Key environment variables used across services:
# Database connections
DSN="host=postgres port=5432 user=postgres password=password dbname=users sslmode=disable"
MONGO_URL="mongodb://mongo:27017"
# Mail configuration
MAIL_HOST=mailhog
MAIL_PORT=1025
FROM_ADDRESS=noreply@example.com
FROM_NAME="Aditya Torgal"
# RabbitMQ
RABBITMQ_URL="amqp://guest:guest@rabbitmq"-
Start all services:
cd project && make up_build
-
Access the frontend: Open http://localhost:8081 in your browser
-
Test different communication patterns:
- HTTP requests through the web interface
- Check RabbitMQ management console (http://localhost:15672)
- Monitor MailHog for sent emails (http://localhost:8025)
-
View logs:
docker-compose logs -f [service-name]
- Container Logs:
docker-compose logs -f - RabbitMQ Management: http://localhost:15672
- Database Access: Available on standard ports
- MailHog Interface: http://localhost:8025
Aditya Torgal
This project demonstrates modern microservices architecture patterns using Go, showcasing different inter-service communication methods and containerized deployment strategies.