Skip to content
Merged

merge #120

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Repository Overview

This repository showcases a robust microservices architecture comprising three distinct services: **Department**, **User**, and **Point**. The project emphasizes code reusability through a common container that initializes essential components such as logging, database connections, and environment variables.


### API Services
- Department Service:
Exposes a **REST** API endpoint: `/api/departments/v1/departments` for retrieving department data.
Expand All @@ -10,13 +10,12 @@ This repository showcases a robust microservices architecture comprising three d
- Point Service:
Utilizes **gRPC** to deliver user point data, which is consumed by the User service, effectively demonstrating inter-service communication.

This design promotes modularity and scalability across the services.

## Key Features

### Architectural Patterns & Design Choices
* **Concurrency Pattern:**
* Utilized in [service/user_service/user/user_service](https://github.com/syedomair/backend-microservices/blob/main/service/user_service/user/user_serivce.go) to execute multiple database queries and gRPC calls concurrently using Go's `errgroup`.
* 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`.
* Enhances the performance of the `GetAllUserStatistics` method by leveraging parallel processing.
* **Dependency Injection Pattern:**
* 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.
Expand All @@ -43,21 +42,29 @@ This design promotes modularity and scalability across the services.
* 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.
* Optimizes resource usage and improves performance by reducing the overhead of repeatedly creating and destroying connections.

### CI/CD Integration:
The repository includes CI/CD workflows located in `.github/workflows`, which automate the deployment process to AWS Elastic Container Registry (ECR) and Elastic Container Service (ECS) servers. This ensures seamless updates and efficient management of service deployments.
### 🚀 Operational Excellence
* **CI/CD:** Automated Docker image builds and deployments to AWS ECS via GitHub Actions.
* **Monitoring:** Integrated Prometheus metrics and pprof profiling for real-time performance insight.
* **Observability:** Structured logging and request tracing throughout the services.
* **Containerization:** Fully dockerized for local development and cloud deployment.

### Performance Monitoring
- **Prometheus Metrics**: Integrated Prometheus metrics allow users to monitor the performance of each service in real-time. This feature provides insights into system health and resource utilization.

- **Memory Profiling with pprof**:
The project includes pprof for memory monitoring, enabling developers to analyze memory usage and optimize performance effectively.

### Testing Framework
- **Integration Testing**:
The system performs integration testing using a mock database running in a test Docker container. This setup ensures that all services interact correctly and maintain data integrity during operations.
### 🧪 Testing Strategy
* **Unit Tests:** Comprehensive tests for all business logic and handlers.
* **Integration Tests:** End-to-end tests using a live test database and gRPC server within Docker, validating the entire service ecosystem.

### 📡 APIs & Communication
* **RESTful APIs:** JSON over HTTP for `user-service` (`/users`) and `department-service` (`/departments`).
* **gRPC:** High-performance RPC for internal communication between `user-service` and `point-service`.

- **Unit Testing**:
Comprehensive unit tests cover all code components, ensuring high code quality and reliability. Each service is rigorously tested to validate functionality and catch potential issues early in the development cycle.

---
## Conclusion
This 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.
---

---