# duongdre/share_bill architecture

> Architecture diagram of the GitHub repository duongdre/share_bill, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/duongdre/share_bill
- Repository: https://github.com/duongdre/share_bill

## Overview

##### Project type and purpose
- From the README (“Share Bill helps you manage your finances.”) and the fact that there are no source directories yet, we infer this is intended as a full-stack finance-management (bill-splitting or expense tracking) application.
- Core use cases: users create/join groups, record expenses, view balances, and settle up.

##### File structure
- Right now there is only README.md. This signals an early-stage repository where nobody has laid out the code yet.

##### README for additional insights
- No further architectural hints are given. You have freedom to propose a standard web-app architecture.
- You may want to add a “Technology Stack” section later (React, Node, PostgreSQL, etc.).

##### Elements
- Clear labels: e.g. “React Web App,” “Expense Service,” “PostgreSQL DB,” “SMTP Email Service.”
- UI components (blue rectangles)
- Backend services (green rectangles)
- External services (gray clouds)

##### Detailed capture of essential components
- Data flows: when a user adds an expense, how the request travels through layers, how the transaction is committed, how balances are recalculated, and how notifications are enqueued and sent.
- Infrastructure concerns: CI/CD pipeline triggering builds, container registry, monitoring/logging (ELK stack or Prometheus + Grafana).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend"
        direction TB
        WebApp["React Web App"]:::ui
        MobileApp["Mobile App"]:::ui
    end

    %% API Layer
    subgraph "API Layer"
        direction TB
        APIGateway["API Gateway"]:::service
    end

    %% Backend Services
    subgraph "Backend Services"
        direction TB
        AuthService["Authentication Service"]:::service
        ExpenseService["Expense Management Service"]:::service
        NotificationWorker["Notification Worker"]:::service
    end

    %% Datastores
    subgraph "Data Stores"
        direction TB
        Postgres["PostgreSQL DB"]:::datastore
        Redis["Redis Cache"]:::datastore
        MQ["Message Queue (RabbitMQ/SQS)"]:::datastore
    end

    %% External Services
    subgraph "External Services"
        direction TB
        OAuth["External Auth Service"]:::external
        PaymentGateway["Payment Gateway"]:::external
        SMTP["SMTP Email Service"]:::external
    end

    %% Infrastructure
    subgraph "Infrastructure"
        direction TB
        CICD["CI/CD Pipeline"]:::infra
        Registry["Container Registry"]:::infra
        K8s["Kubernetes Cluster"]:::infra
        Monitoring["Monitoring (Prometheus/Grafana)"]:::infra
    end

    %% Connections
    WebApp -->|HTTPS API Calls| APIGateway
    MobileApp -->|HTTPS API Calls| APIGateway

    APIGateway -->|Auth Requests| AuthService
    APIGateway -->|Expense Requests| ExpenseService
    APIGateway -->|Notification Requests| NotificationWorker

    AuthService -->|Validates| OAuth
    ExpenseService -->|Reads/Writes| Postgres
    ExpenseService -->|Caches| Redis
    ExpenseService -->|Publishes| MQ

    NotificationWorker -->|Subscribes| MQ
    NotificationWorker -->|Sends Email| SMTP

    %% Infrastructure Flows
    CICD -->|Builds/Pushes| Registry
    Registry -->|Deploys| K8s
    K8s -->|Runs Services| APIGateway
    K8s -->|Runs Services| AuthService
    K8s -->|Runs Services| ExpenseService
    K8s -->|Runs Services| NotificationWorker
    K8s -->|Hosts DB/Caches/Queue| Postgres
    K8s -->|Hosts DB/Caches/Queue| Redis
    K8s -->|Hosts DB/Caches/Queue| MQ

    Monitoring -->|Scrapes Metrics| K8s

    %% Styles
    classDef ui fill:#4287f5,stroke:#333,stroke-width:1px,color:white;
    classDef service fill:#2ca02c,stroke:#333,stroke-width:1px,color:white;
    classDef datastore fill:#ff7f0e,stroke:#333,stroke-width:1px,color:white;
    classDef external fill:#7f7f7f,stroke:#333,stroke-width:1px,color:white;
    classDef infra fill:#17becf,stroke:#333,stroke-width:1px,color:white;
```
