# rewyekha/python-microservices-app architecture

> Architecture diagram of the GitHub repository rewyekha/python-microservices-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rewyekha/python-microservices-app
- Repository: https://github.com/rewyekha/python-microservices-app

## Overview

Based on our analysis of the file tree and README, this project is a Python-based microservices application called “video-converter” that converts mp4 videos to mp3. It is designed to run on AWS EKS using Kubernetes and Helm for deployment. The architecture uses several microservices and external components (databases and a message broker) to manage a complete end-to-end video conversion workflow.

##### Main Components
- AWS EKS Cluster – Represent the deployment environment where all Kubernetes workloads (node groups, pods, etc.) run.
- Helm Charts – Show separate Helm charts for managing external services like MongoDB, PostgreSQL, and RabbitMQ.
- Microservices:
- Auth Service (“auth-service”): Handles authentication, deployed via its own manifest with Dockerfile and associated configuration.
- Gateway Service (“gateway-service”): Acts as the API gateway handling requests (login, file upload/download) and redirects to respective services.
- Converter Service (“converter-service”): Contains the logic for converting mp4 videos to mp3. It interacts with RabbitMQ queues (named “mp3” and “video”) for asynchronous processing.
- Notification Service (“notification-service”): Responsible for sending status updates and notifications (e.g., via email and 2FA).
- External Systems:
- Databases: PostgreSQL and MongoDB (for storing application data); each has its own Helm chart with configuration and initialization (init.sql for Postgres).
- Message Broker: RabbitMQ, used for queuing video conversion tasks.

##### Relationships and Interactions
- When a user logs in or uploads a video, the request flows through the Gateway Service.
- The Gateway Service then interacts with the Auth Service for authentication.
- Upon successful verification, the upload triggers the Converter Service which reads from a designated queue (“video”) in RabbitMQ.
- The Converter Service processes the video (conversion from mp4 to mp3) and may then trigger notification messages or use the “mp3” queue for delivering results.
- Data persistence happens via MongoDB and PostgreSQL as needed.
- Connections to external messaging (RabbitMQ) and database connection flows from Helm charts to the relevant microservices.

##### Architectural Patterns & Design Principles
- Microservices Architecture: Emphasize the separation of concerns between discrete services (auth, gateway, converter, notification).
- Containerization & Orchestration: Represent Docker containers for each service and Kubernetes as the platform orchestrating these containers.
- Declarative Infrastructure: Highlight that all services and external components are deployed using Helm charts and Kubernetes manifests.
- Messaging Driven: Indicate usage of RabbitMQ for decoupling and asynchronous communication (message queuing for conversion tasks).

##### Including Technologies, Frameworks, and Libraries
- Technologies: AWS EKS, Kubernetes, Helm, Docker.
- Databases: MongoDB, PostgreSQL.
- Messaging: RabbitMQ.
- Programming Language: Python (evident from requirements.txt and Python-based code in each service).
- Other: Kubernetes manifests for deployment, ConfigMaps, Secrets, and volume definitions as part of Helm charts.

##### Overall Detail and Clarity
- As many components as possible to represent all parts of the system. Avoid oversimplification—include every subsystem mentioned (from Helm charts for MongoDB, PostgreSQL, RabbitMQ to each microservice’s manifest deployments).
- How the system’s components are interconnected in the AWS EKS environment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    Client("External Client"):::client

    %% AWS EKS Cluster Subgraph
    subgraph "AWS EKS Cluster"
        direction TB
        GW("Gateway Service"):::microservice
        Auth("Auth Service"):::microservice
        Conv("Converter Service"):::microservice
        Notif("Notification Service"):::microservice
    end

    %% External Services via Helm Charts Subgraph
    subgraph "External Services (Helm Charts)"
        direction TB
        Mongo("MongoDB"):::db
        Postgres("PostgreSQL"):::db
        Rabbit("RabbitMQ"):::mq
    end

    %% Interactions from External Client to Gateway Service
    Client -->|"API_call"| GW

    %% Interactions within Microservices and External Systems
    GW -->|"auth_request"| Auth
    GW -->|"publish_video"| Rabbit
    Rabbit -->|"deliver_video"| Conv
    Conv -->|"notify"| Notif

    %% Database interactions
    Auth -->|"user_data"| Postgres
    GW -->|"store_uploads"| Mongo
    GW -->|"store_sessions"| Postgres
    Conv -->|"update_status"| Mongo
    Notif -->|"notification_logs"| Postgres

    %% Click Events
    click Mongo "https://github.com/rewyekha/python-microservices-app/tree/main/Helm_charts/MongoDB"
    click Postgres "https://github.com/rewyekha/python-microservices-app/tree/main/Helm_charts/Postgres"
    click Rabbit "https://github.com/rewyekha/python-microservices-app/tree/main/Helm_charts/RabbitMQ"
    click Auth "https://github.com/rewyekha/python-microservices-app/tree/main/src/auth-service"
    click GW "https://github.com/rewyekha/python-microservices-app/tree/main/src/gateway-service"
    click Conv "https://github.com/rewyekha/python-microservices-app/tree/main/src/converter-service"
    click Notif "https://github.com/rewyekha/python-microservices-app/tree/main/src/notification-service"

    %% Styles
    classDef microservice fill:#FFE4B5,stroke:#CD853F,stroke-width:2px;
    classDef db fill:#B0E0E6,stroke:#4682B4,stroke-width:2px,stroke-dasharray: 5 5;
    classDef mq fill:#98FB98,stroke:#2E8B57,stroke-width:2px,stroke-dasharray: 3 3;
    classDef client fill:#FFD700,stroke:#B8860B,stroke-width:2px;
    classDef aws fill:#FFDEAD,stroke:#D2691E,stroke-width:2px;
```
