AddNet is a distributed microservice application demonstrating communication between services using gRPC and RabbitMQ message queuing, inspired by Eng Ahmed El Taweel video.
The application consists of two main services:
- Service A (Go): A gRPC server that provides an addition operation and forwards results to RabbitMQ
- Service B (TypeScript/Bun): A consumer that reads messages from RabbitMQ, adds the new value to an existing total, saves the updated value to a file, and exposes an HTTP endpoint to retrieve the latest result
- Client makes gRPC request to Service A with two numbers
- Service A adds numbers and returns result
- Service A sends result to RabbitMQ queue
- Service B consumes messages and persists results
- Latest result available via Service B's HTTP endpoint
- Reliable Messaging: Outbox pattern ensures message delivery
- Monitoring: Prometheus metrics and Grafana dashboard
- Load Testing: k6 test scripts included
- Containerized: Docker Compose for easy deployment
- Multi-language: Go and TypeScript services
- Docker and Docker Compose
- Go 1.24+
- Bun 1.2.9+ (for Service B)
- gRPC tools (for development)
docker-compose up --build
This will start:
- Service A (gRPC server on port 50051)
- Service B (HTTP server on port 2113)
- RabbitMQ (management UI on port 15672)
- PostgreSQL database
- Prometheus (on port 9090)
- Grafana (on port 3000)
- Service A gRPC:
localhost:50051
- Service B HTTP:
http://localhost:2113/latest
- RabbitMQ Management:
http://localhost:15672
(guest/guest) - Prometheus:
http://localhost:9090
- Grafana:
http://localhost:3000
(admin/grafana)
cd service_a
go run cmd/server/main.go
cd service_b
bun install
bun run index.ts
After modifying addition.proto
:
cd service_a
protoc --go_out=. --go-grpc_out=. internal/proto/addition.proto
gRPC Test (Service A):
k6 run service_a/k6_grpc_test.js
REST Test (Service B):
k6 run service_b/k6_rest_test.js
The project includes preconfigured Grafana dashboards showing:
- Request latency
- Throughput
- Error rates
- Queue delivery metrics
the-sabra-addnet/
├── service_a/ # Go gRPC service
│ ├── cmd/ # Application entry points
│ ├── internal/ # Internal application code
│ └── proto/ # Protocol Buffer definitions
├── service_b/ # TypeScript consumer service
├── prometheus/ # Prometheus configuration
└── grafana/ # Grafana dashboards and datasources
This project was inspired by Eng Ahmed El Taweel excellent tutorial on building distributed systems. Check out his original video for more insights into microservice architecture.