# bahtiyorjon05/paymeweb architecture

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

- Interactive diagram: https://gitdiagram.com/bahtiyorjon05/paymeweb
- Repository: https://github.com/bahtiyorjon05/paymeweb

## Overview

##### Project type and purpose
- This is a full-stack, cloud-hosted payment platform built with Django (Python) and a simple JavaScript/HTML/CSS frontend.
- It handles user authentication (2FA), card management, money transfers, currency conversion, transaction history, and provides an admin dashboard.

##### File structure and README
- Top-level files: LICENSE, README.md
- README lists:
- Backend: Python, Django, Django REST Framework (DRF)
- Frontend: HTML5/CSS3/JavaScript (server-rendered or static assets)
- Database: Azure SQL Database
- Cloud: Microsoft Azure (App Service, Container Registry)
- DevOps: Docker
- Security: JWT, CSRF

##### Main components
a. Client (Web Browser)
– Sends HTTP(S) requests, handles 2FA UI, transaction forms, dashboards, charts
b. Azure Front Door / Application Gateway (optional)
– SSL termination, WAF, global load balancing
c. Azure App Service (Container)
– Hosts the Dockerized Django application
d. Django Backend
– Django REST Framework endpoints
– Business logic for auth, payments, cards, currency conversion, reporting
– JWT and CSRF middleware
e. Azure SQL Database
– Stores users, cards, transactions, exchange rates, logs
f. External Services
– Real-time exchange-rate API
– (Optional) Email/SMS providers for 2FA, notifications
g. Azure Container Registry (ACR)
– Stores Docker images
h. CI/CD Pipeline
– GitHub/GitLab → build image → push to ACR → deploy to App Service

##### Interactions and data flow
1. User Browser → HTTPS → Azure Front Door/Gateway → App Service
2. App Service (Django) ↔ Azure SQL Database (queries & transactions)
3. Django Backend → External Exchange-Rate API (HTTP)
4. Django Backend → External 2FA SMS/Email API
5. CI/CD: Source Control → Build → ACR → Deployment

##### Architectural patterns and design principles
- Layered architecture: Presentation (frontend), Application (Django views/DRF), Persistence (Azure SQL)
- Stateless backend containers behind Azure App Service
- Secure by design: TLS at edge, JWT for API, CSRF protection
- Containerization for reproducibility & scalability
- Cloud-native: PaaS (App Service), managed SQL

##### Putting it all together
- Above or below, annotate the CI/CD flow: Git → Build → ACR → Deploy → App Service.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client to Cloud
    A["User Browser"]:::frontend
    B["Azure Front Door / Application Gateway"]:::cloud
    A -->|"HTTPS Request"| B

    %% App Service Container
    subgraph "Azure App Service"
        direction TB
        C["Django + DRF Container"]:::backend
        subgraph "Django Modules"
            direction TB
            Auth["Authentication Module"]:::backend
            Pay["Payment Module"]:::backend
            Rep["Reporting Module"]:::backend
        end
    end
    B -->|"Forward Request"| C
    C -->|"Handles Auth, Payments, Reporting"| Auth
    C -->|"Handles Auth, Payments, Reporting"| Pay
    C -->|"Handles Auth, Payments, Reporting"| Rep

    %% Data Store
    D["Azure SQL Database"]:::datastore
    C -->|"SQL Queries / Transactions"| D

    %% External Services
    E["Exchange-Rate API"]:::external
    F["2FA SMS/Email API"]:::external
    C -->|"Fetch Rates"| E
    C -->|"Send 2FA Code / Notifications"| F

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        G["GitHub/GitLab (Source Control)"]:::cloud
        H["Build Docker Image"]:::backend
        I["Azure Container Registry (ACR)"]:::cloud
        J["Deploy to App Service"]:::backend
    end
    G -.-> H
    H -.-> I
    I -.-> J
    J -.-> C

    %% Documentation
    subgraph "Project Documentation"
        direction TB
        K["README.md"]:::docs
        L["LICENSE"]:::docs
    end

    %% Click Events
    click K "https://github.com/bahtiyorjon05/paymeweb/blob/main/README.md"
    click L "https://github.com/bahtiyorjon05/paymeweb/tree/main/LICENSE"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef backend fill:#d4edda,stroke:#333,stroke-width:1px
    classDef datastore fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px
    classDef cloud fill:#d1ecf1,stroke:#333,stroke-width:1px
    classDef docs fill:#f8d7da,stroke:#333,stroke-width:1px
```
