{"id":27437192,"url":"https://github.com/the-sabra/addnet","last_synced_at":"2026-04-24T16:04:10.167Z","repository":{"id":287726470,"uuid":"965527080","full_name":"the-sabra/addNet","owner":"the-sabra","description":"addNet","archived":false,"fork":false,"pushed_at":"2025-04-14T14:36:04.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T20:19:22.968Z","etag":null,"topics":["distributed-systems","grpc","microservices","rest-api","rpc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/the-sabra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-13T11:11:10.000Z","updated_at":"2025-04-14T14:36:07.000Z","dependencies_parsed_at":"2025-04-14T20:19:23.767Z","dependency_job_id":"7007c614-54b5-4232-9455-80b66800faff","html_url":"https://github.com/the-sabra/addNet","commit_stats":null,"previous_names":["the-sabra/addnet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/the-sabra/addNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-sabra%2FaddNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-sabra%2FaddNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-sabra%2FaddNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-sabra%2FaddNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/the-sabra","download_url":"https://codeload.github.com/the-sabra/addNet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-sabra%2FaddNet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32230421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-systems","grpc","microservices","rest-api","rpc"],"created_at":"2025-04-14T20:19:21.000Z","updated_at":"2026-04-24T16:04:10.162Z","avatar_url":"https://github.com/the-sabra.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AddNet - Distributed Microservice Application\n\n[![Go](https://img.shields.io/badge/Go-1.24+-blue.svg)](https://golang.org/)\n[![Bun](https://img.shields.io/badge/Bun-1.2.9+-yellow.svg)](https://bun.sh/)\n[![RabbitMQ](https://img.shields.io/badge/RabbitMQ-3.9+-orange.svg)](https://www.rabbitmq.com/)\n[![Prometheus](https://img.shields.io/badge/Prometheus-2.33+-red.svg)](https://prometheus.io/)\n[![Grafana](https://img.shields.io/badge/Grafana-8.5+-purple.svg)](https://grafana.com/)\n\nAddNet is a distributed microservice application demonstrating communication between services using gRPC and RabbitMQ message queuing, inspired by [Eng Ahmed El Taweel video](https://youtu.be/Ur6b1NWGbYE?si=54EkJ_Avy5QT-YGF).\n\n## System Architecture\n\n![Architecture Diagram](screenshots/add-net.png)\n\nThe application consists of two main services:\n\n- **Service A** (Go): A gRPC server that provides an addition operation and forwards results to RabbitMQ\n- **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\n\n### Communication Flow\n\n1. Client makes gRPC request to Service A with two numbers\n2. Service A adds numbers and returns result\n3. Service A sends result to RabbitMQ queue\n4. Service B consumes messages and persists results\n5. Latest result available via Service B's HTTP endpoint\n\n## Features\n\n- **Reliable Messaging**: Outbox pattern ensures message delivery\n- **Monitoring**: Prometheus metrics and Grafana dashboard\n- **Load Testing**: k6 test scripts included\n- **Containerized**: Docker Compose for easy deployment\n- **Multi-language**: Go and TypeScript services\n\n## Monitoring\n\n![Monitoring Diagram](screenshots/matric.jpeg)\n\n## Prerequisites\n\n- Docker and Docker Compose\n- Go 1.24+\n- Bun 1.2.9+ (for Service B)\n- gRPC tools (for development)\n\n## Getting Started\n\n### Running with Docker Compose\n\n```bash\ndocker-compose up --build\n```\n\nThis will start:\n\n- Service A (gRPC server on port 50051)\n- Service B (HTTP server on port 2113)\n- RabbitMQ (management UI on port 15672)\n- PostgreSQL database\n- Prometheus (on port 9090)\n- Grafana (on port 3000)\n\n### Accessing Services\n\n- **Service A gRPC**: `localhost:50051`\n- **Service B HTTP**: `http://localhost:2113/latest`\n- **RabbitMQ Management**: `http://localhost:15672` (guest/guest)\n- **Prometheus**: `http://localhost:9090`\n- **Grafana**: `http://localhost:3000` (admin/grafana)\n\n## Development\n\n### Service A (Go)\n\n```bash\ncd service_a\ngo run cmd/server/main.go\n```\n\n### Service B (TypeScript)\n\n```bash\ncd service_b\nbun install\nbun run index.ts\n```\n\n### Regenerating gRPC Code\n\nAfter modifying `addition.proto`:\n\n```bash\ncd service_a\nprotoc --go_out=. --go-grpc_out=. internal/proto/addition.proto\n```\n\n## Testing\n\n### Load Testing with k6\n\n**gRPC Test (Service A):**\n\n```bash\nk6 run service_a/k6_grpc_test.js\n```\n\n**REST Test (Service B):**\n\n```bash\nk6 run service_b/k6_rest_test.js\n```\n\n## Monitoring\n\nThe project includes preconfigured Grafana dashboards showing:\n\n- Request latency\n- Throughput\n- Error rates\n- Queue delivery metrics\n\n## Project Structure\n\n```\nthe-sabra-addnet/\n├── service_a/          # Go gRPC service\n│   ├── cmd/           # Application entry points\n│   ├── internal/      # Internal application code\n│   └── proto/         # Protocol Buffer definitions\n├── service_b/         # TypeScript consumer service\n├── prometheus/        # Prometheus configuration\n└── grafana/           # Grafana dashboards and datasources\n```\n\n## Acknowledgments\n\nThis project was inspired by Eng Ahmed El Taweel excellent tutorial on building distributed systems. Check out his [original video](https://youtu.be/Ur6b1NWGbYE?si=54EkJ_Avy5QT-YGF) for more insights into microservice architecture.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-sabra%2Faddnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-sabra%2Faddnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-sabra%2Faddnet/lists"}