{"id":36733575,"url":"https://github.com/syedomair/backend-microservices","last_synced_at":"2026-01-12T12:16:22.853Z","repository":{"id":276855842,"uuid":"930527753","full_name":"syedomair/backend-microservices","owner":"syedomair","description":"Golang Software Design Pattern Showcase","archived":false,"fork":false,"pushed_at":"2025-10-08T07:46:21.000Z","size":407,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-12T03:39:16.725Z","etag":null,"topics":["aws","design-patterns","docker","git-workflow","gorm","grpc","microservice","postgresql","prometheus"],"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/syedomair.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-10T19:23:50.000Z","updated_at":"2025-10-08T07:46:24.000Z","dependencies_parsed_at":"2025-02-10T20:34:23.661Z","dependency_job_id":"57fe1d8a-87f7-4145-af25-749f53719857","html_url":"https://github.com/syedomair/backend-microservices","commit_stats":null,"previous_names":["syedomair/backend-example","syedomair/backend-microservices"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/syedomair/backend-microservices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedomair%2Fbackend-microservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedomair%2Fbackend-microservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedomair%2Fbackend-microservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedomair%2Fbackend-microservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syedomair","download_url":"https://codeload.github.com/syedomair/backend-microservices/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedomair%2Fbackend-microservices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["aws","design-patterns","docker","git-workflow","gorm","grpc","microservice","postgresql","prometheus"],"created_at":"2026-01-12T12:16:22.748Z","updated_at":"2026-01-12T12:16:22.838Z","avatar_url":"https://github.com/syedomair.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributed Microservices Demo in Go\n\nA cloud-native, production-ready demonstration of a distributed system built with Go. This project features three containerized microservices (REST \u0026 gRPC) communicating over a network, backed by PostgreSQL, deployed via CI/CD to AWS ECS, and fully monitored with Prometheus and Grafana.\n\n# Demo\n**Run Locally:**\n```bash\nmake run_docker\n```\nPrerequisites: Docker and Docker Compose must be installed on your machine.\n\n\n# Architecture Overview\n\n```mermaid\ngraph TB\n    subgraph AWS ECS / Docker Compose\n        A[Client] --\u003e B[API Gateway]\n        B --\u003e C[User Service]\n        C --\u003e E[(User DB)]\n        C -- gRPC --\u003e G[Point Service]\n        G --\u003e H[(Point DB)]\n        B --\u003e D[Department Service]\n        D --\u003e F[(Department DB)]\n    end\n``` \n\n# Technology Stack \nGo, PostgreSQL, Docker, gRPC, Prometheus, Grafana, GitHub Action\n\n# Key Features\n\n### 🏗️ Architecture \u0026 Design Patterns\nThis project is a textbook example of practical software engineering patterns in Go:\n* **Concurrency Pattern:**\n    * Utilized in [service/user_service/user/user_service](https://github.com/syedomair/backend-microservices/blob/main/service/user_service/user/user_service.go) to execute multiple database queries and gRPC calls concurrently using Go's `errgroup`.\n    * Enhances the performance of the `GetAllUserStatistics` method by leveraging parallel processing.\n* **Dependency Injection Pattern:**\n    * Utilized in [lib/container/container.go](https://github.com/syedomair/backend-microservices/blob/main/lib/container/container.go) to manage logging, database connections, and environment variables.\n    * Promotes modularity and flexibility by injecting dependencies into a central container.\n* **Singleton Pattern:**\n    * Implemented in [lib/container/container.go](https://github.com/syedomair/backend-microservices/blob/main/lib/container/container.go) through synchronized lazy initialization (`sync.Mutex` + instance check) in `PostgresAdapter` and `MySQLAdapter`.\n    * Ensures only one database connection instance is created per adapter while maintaining thread safety.\n* **Adapter Pattern:**\n    * Used in [lib/container/container.go](https://github.com/syedomair/backend-microservices/blob/main/lib/container/container.go) to create a unified database interface (`Db`) with concrete implementations (`PostgresAdapter` and `MySQLAdapter`).\n    * Enables seamless switching between database providers without modifying client code.\n* **Factory Pattern:**\n    * Utilized in [lib/container/db.go](https://github.com/syedomair/backend-microservices/blob/main/lib/container/db.go) through the `NewDBConnectionAdapter` function.\n    * Acts as a factory method to create instances of different database adapters based on the specified database type, encapsulating object creation logic.\n* **External Configuration Pattern:**\n    * Utilized in [lib/container/container.go](https://github.com/syedomair/backend-microservices/blob/main/lib/container/container.go) to manage and validate essential configuration through environment variables.\n    * Ensures centralized and type-safe access to settings, promoting flexibility and ease of deployment.\n* **Decorator Pattern:**\n    * Utilized in [lib/response/response.go](https://github.com/syedomair/backend-microservices/blob/main/lib/response/response.go) to dynamically add behaviors to response handlers.\n    * Allows setting headers or handling different response types without altering the underlying handler implementation.\n* **Middleware Pattern:**\n    * Utilized in [lib/router/router.go](https://github.com/syedomair/backend-microservices/blob/main/lib/router/router.go) to chain multiple handlers that add functionalities like logging, request ID management, and Prometheus metrics collection.\n    * Enhances the HTTP request processing pipeline with modular and reusable components.\n* **Object Pool Pattern:**\n    * Implemented in [lib/container/connection.go](https://github.com/syedomair/backend-microservices/blob/main/lib/container/connection.go) to manage a pool of reusable gRPC client connections.\n    * Optimizes resource usage and improves performance by reducing the overhead of repeatedly creating and destroying connections.\n    \n### 🚀 Operational Excellence\n*   **CI/CD:** Automated Docker image builds and deployments to AWS ECS via GitHub Actions.\n*   **Monitoring:** Integrated Prometheus metrics and pprof profiling for real-time performance insight.\n*   **Observability:** Structured logging and request tracing throughout the services.\n*   **Containerization:** Fully dockerized for local development and cloud deployment.\n\n\n### 🧪 Testing Strategy\n*   **Unit Tests:** Comprehensive tests for all business logic and handlers.\n*   **Integration Tests:** End-to-end tests using a live test database and gRPC server within Docker, validating the entire service ecosystem.\n\n### 📡 APIs \u0026 Communication\n*   **RESTful APIs:** JSON over HTTP for `user-service` (`/users`) and `department-service` (`/departments`).\n*   **gRPC:** High-performance RPC for internal communication between `user-service` and `point-service`.\n\n---\n\n# Conclusion\nThis microservices architecture not only demonstrates best practices in software design but also incorporates essential features for modern application development, such as CI/CD, performance monitoring, and robust testing frameworks. By leveraging these technologies, developers can build scalable, maintainable, and high-performing applications.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyedomair%2Fbackend-microservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyedomair%2Fbackend-microservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyedomair%2Fbackend-microservices/lists"}