# damaradiprabowo/ppp-calculator-flask architecture

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

- Interactive diagram: https://gitdiagram.com/damaradiprabowo/ppp-calculator-flask
- Repository: https://github.com/damaradiprabowo/ppp-calculator-flask

## Overview

##### Main Components

a. Client-Side Layer:
- Web Browser component
- Static Assets (CSS/JS)
- Main interface components (salary input, country selectors)

b. Server-Side Layer:
- Flask Application Server
- Route handlers
- PPP calculation logic

c. External Services Layer:
- World Bank API
- Rest Countries API

**[Client Tier]**

**[Application Tier]**

**[External Services Tier]**

##### Detailed Component Breakdown

Client Tier:
**┌─ Web Browser ─────────────┐**
- HTML (index.html)     │
- CSS (styles.css)      │
- JavaScript (script.js)│
- ┘

Application Tier:
**┌─ Flask Server (app.py) ──┐**
- Route Handlers       │
- PPP Calculator Logic │
- API Integration      │
- ┘

External Services:
**┌─ External APIs ──────────┐**
- World Bank API       │
- Rest Countries API   │
- ┘

##### Data Flow Representation

Following key interactions:
- Browser to Flask Server: HTTP requests for salary calculations
- Flask Server to External APIs: API calls for country data
- Server to Client: JSON responses with calculated results

##### Additional Elements

- Request/Response formats between components
- Key HTTP methods (GET/POST)
- Data transformation points
- Error handling paths

##### Specific Implementation Details

Notes about:
- Static file serving from Flask
- API endpoint structure
- Browser-server communication patterns
- Data caching possibilities (if implemented)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef client fill:#dae8fc,stroke:#6c8ebf
    classDef server fill:#d5e8d4,stroke:#82b366
    classDef external fill:#ffe6cc,stroke:#d79b00
    classDef static fill:#fff2cc,stroke:#d6b656

    %% Client Layer
    subgraph Client
        Browser["Web Browser"]
        UI["User Interface"]:::client
        HTML["HTML Template"]:::client
        CSS["CSS Styles"]:::client
        JS["JavaScript Logic"]:::client
    end

    %% Application Layer
    subgraph Server
        Flask["Flask Server"]:::server
        Routes["Route Handlers"]:::server
        Calculator["PPP Calculator"]:::server
        APIIntegration["API Integration"]:::server
    end

    %% External Services Layer
    subgraph External
        WorldBank["World Bank API"]:::external
        RestCountries["Rest Countries API"]:::external
    end

    %% Relationships
    Browser --> UI
    UI --> HTML
    UI --> CSS
    UI --> JS
    JS --> Routes
    Routes --> Calculator
    Calculator --> APIIntegration
    APIIntegration --> WorldBank
    APIIntegration --> RestCountries
    Calculator --> JS

    %% Click Events
    click HTML "https://github.com/damaradiprabowo/ppp-calculator-flask/blob/main/templates/index.html"
    click CSS "https://github.com/damaradiprabowo/ppp-calculator-flask/blob/main/static/css/styles.css"
    click JS "https://github.com/damaradiprabowo/ppp-calculator-flask/blob/main/static/js/script.js"
    click Flask "https://github.com/damaradiprabowo/ppp-calculator-flask/blob/main/app.py"
    click Routes "https://github.com/damaradiprabowo/ppp-calculator-flask/blob/main/app.py"
    click Calculator "https://github.com/damaradiprabowo/ppp-calculator-flask/blob/main/app.py"

    %% Legend
    subgraph Legend
        Client_Component["Client Component"]:::client
        Server_Component["Server Component"]:::server
        External_Component["External Service"]:::external
    end
```
