How emash90/wama_microservices works
Project Type & Purpose
• This is a containerized microservices architecture aimed at Rental Property Management. It handles tenant management, house management, and payment management.
• The system uses an API Gateway to route external requests to individual backend services. It also leverages RabbitMQ for messaging between services (e.g., for updating house occupancy when tenants are added) and is deployed using container technologies (Docker) on Google Cloud Run.
Analyzing the File Structure
• The “backend” directory is subdivided into several microservices:
• API Gateway: Routes incoming API requests, contains middleware and route definitions.
• Tenant, House, Payment, (and User) Services: Each service has its own controllers, models, routes, and a service layer. Each service contains its configuration (including database connection files), utility functions (such as RabbitMQ setups), and Docker configuration.
• There are multiple frontend projects (React-based, Next.js-based, and plain React projects) that suggest different UI implementations to interact with the backend.
• Presence of Dockerfiles, docker-compose.yml, and GitHub workflows indicates containerization, CI/CD practices, and cloud deployment.
Key Components
a. Frontend(s):
b. API Gateway:
• A central component that receives incoming requests from the frontends and routes them to the appropriate microservice.
c. Microservices:
• Tenant Service: Handles tenant-related operations.
• House Service: Manages property data, occupancy status, and house details.
• Payment Service: Tracks rental payments and financial reporting.
• User Service: Manages user authentication and authorization (if applicable).
• Each microservice should be noted as having its own internal layers such as controllers, routes, services, and models.
• That each service contains its own database configuration (likely connecting to a dedicated or shared database instance).
d. Message Broker:
• RabbitMQ is used for inter-service messaging to update state changes (for example, updating house occupancy status when tenants change).
e. Deployment & Infrastructure:
• Containerization (Docker) for each service.
• Google Cloud Run which hosts the services for scalability and availability.
• CI/CD pipelines indicated by GitHub workflows (for deployment automation).
Relationships and Interactions
• The Frontend sends requests to the API Gateway.
• The API Gateway routes these requests to the appropriate backend microservices (Tenant, House, Payment, User).
• Microservices may communicate with each other asynchronously via RabbitMQ for operations such as updating house occupancy after a tenant event.
• Each microservice interacts with its own database layer (or a designated datastore).
• The deployment layer wraps around these components showing Docker containers orchestrated by Docker Compose and hosted on Google Cloud Run.
Architectural Patterns & Design Principles
• Microservices Architecture: Each functional area is independent and containerized.
• API Gateway Pattern: A dedicated gateway that simplifies client communication and abstracts the underlying service structure.
• Event-Driven Communication: Use of RabbitMQ for asynchronous inter-service messaging.
• Containerization & Cloud Deployment: Every service is containerized, ensuring consistency across environments and deployed on a scalable cloud platform.