# se701-group6/a2 architecture

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

- Interactive diagram: https://gitdiagram.com/se701-group6/a2
- Repository: https://github.com/se701-group6/a2

## Overview

##### Main Components
- Frontend (Web App):
- Built in React, located in the "split-webapp/split" directory.
- Uses Material-UI for user interface elements.
- Includes pages (Home, Login, SignUp, Split details, and Transactions) and components (AuthorizedRoute, MenuBar, etc.).
- Backend (Server):
- Implemented in Python with CherryPy as the web server framework.
- Key files include main.py, server.py, and several API endpoint modules (account.py, bill_data.py, bill_exec.py, pay_exec.py), which indicate an API-driven design.
- Incorporates a lightweight DB manager that connects with SQLite.
- Database:
- SQLite is used as the database.
- Deployment/CI-CD:
- Presence of Dockerfile, .dockerignore, and GitHub Actions workflows for testing and deployment indicates automation and containerization practices.

##### Detail the Relationships and Interactions
- Optionally, show that the deployment pipeline (GitHub workflows and Docker) supports the continuous integration & delivery aspects of both the Frontend and Backend.

##### Architectural Patterns & Design Principles
- Separation of Concerns: Clearly divide the system into a client (React web app), server (CherryPy APIs), and a database (SQLite).
- API-driven Design: Emphasize the RESTful API endpoints used by the frontend to perform operations like account management and bill processing.
- Containerization & CI/CD: Note the Dockerfile and GitHub workflows that streamline build, test, and deployment processes.

##### Relevant Technologies, Frameworks, and Libraries
- Frontend: React, Material-UI, npm.
- Backend: Python, CherryPy, SQLite.
- Additional Tools: Docker (for containerization), GitHub Actions (for CI/CD workflows).

##### Detail
- For clarity, you might also illustrate potential error-handling or state management aspects in the React app (e.g., UserContext usage).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["React Frontend"]:::frontend
        FE_Pages["Pages"]:::frontend
        FE_Components["Components"]:::frontend
    end
    FE -->|"contains"| FE_Pages
    FE -->|"contains"| FE_Components

    %% Backend Layer
    subgraph "Backend Layer"
        BS["CherryPy API Server"]:::backend
        %% Application Components
        subgraph "Application Components"
            MP["main.py"]:::backend
            SP["server.py"]:::backend
            subgraph "API Endpoints"
                AEP["account.py"]:::backend
                BDP["bill_data.py"]:::backend
                BEP["bill_exec.py"]:::backend
                PEP["pay_exec.py"]:::backend
            end
            DM["DB Manager"]:::backend
        end
        BS -->|"launches"| MP
        BS -->|"launches"| SP
        BS -->|"handles"| AEP
        BS -->|"handles"| BDP
        BS -->|"handles"| BEP
        BS -->|"handles"| PEP
        BS -->|"utilizes"| DM
    end

    %% Database Layer
    subgraph "Database Layer"
        DB["SQLite Database"]:::database
    end
    DM -->|"SQLQueries"| DB

    %% Deployment / CI-CD
    subgraph "Deployment/CI-CD"
        DF["Dockerfile"]:::deployment
        DI[".dockerignore"]:::deployment
        GH["GitHub Workflows"]:::deployment
    end
    GH -->|"CI/CDpipeline"| FE
    GH -->|"CI/CDpipeline"| BS
    DF -->|"containerizes"| FE
    DF -->|"containerizes"| BS

    %% Communication between Frontend and Backend
    FE -->|"HTTPRequest/Response"| BS

    %% Styles
    classDef frontend fill:#add8e6,stroke:#00008b,stroke-width:2px;
    classDef backend fill:#ffcccb,stroke:#8b0000,stroke-width:2px;
    classDef database fill:#98fb98,stroke:#006400,stroke-width:2px;
    classDef deployment fill:#fffacd,stroke:#daa520,stroke-width:2px;

    %% Click Events for Frontend Components
    click FE "https://github.com/se701-group6/a2/tree/master/split-webapp/split"
    click FE_Pages "https://github.com/se701-group6/a2/tree/master/split-webapp/split/src/pages"
    click FE_Components "https://github.com/se701-group6/a2/tree/master/split-webapp/split/src/components"

    %% Click Events for Backend Components
    click MP "https://github.com/se701-group6/a2/blob/master/server/src/main.py"
    click SP "https://github.com/se701-group6/a2/blob/master/server/src/server.py"
    click AEP "https://github.com/se701-group6/a2/blob/master/server/src/api/account.py"
    click BDP "https://github.com/se701-group6/a2/blob/master/server/src/api/bill_data.py"
    click BEP "https://github.com/se701-group6/a2/blob/master/server/src/api/bill_exec.py"
    click PEP "https://github.com/se701-group6/a2/blob/master/server/src/api/pay_exec.py"
    click DM "https://github.com/se701-group6/a2/blob/master/server/src/db_manager.py"

    %% Click Events for Deployment / CI-CD Components
    click DF "https://github.com/se701-group6/a2/tree/master/Dockerfile"
    click DI "https://github.com/se701-group6/a2/blob/master/.dockerignore"
    click GH "https://github.com/se701-group6/a2/tree/master/.github/workflows"
```
