# aashishnandakumar/mirapay-backend architecture

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

- Interactive diagram: https://gitdiagram.com/aashishnandakumar/mirapay-backend
- Repository: https://github.com/aashishnandakumar/mirapay-backend

## Overview

##### Main Components

a. Frontend Layer:
- Two separate frontend applications:
- User Information Collection Portal
- Smart Invoice Generator Portal
- To the backend via REST APIs

b. Backend Layer (Django):
- Core Application (FacePay)
- Main Application Module (FacePayApp)
- Authentication & Authorization
- API Endpoints
- Utility Services:
- Email Service
- SMS Service
- Payment Processing
- Facial Recognition System

c. Database Layer:
- SQLite Database (as indicated by db.sqlite3)
- Main data models from FacePayApp/models.py

d. External Services Integration:
- Payment Gateway Integration
- Cloud Storage for Facial Data
- Communication Services (Email/SMS)

##### Component Relationships

- Frontend → Backend API communication
- Backend → Database operations
- Backend → External Services connections
- Utility Services interconnections

##### Architectural Patterns to Highlight

- Django's MVT (Model-View-Template) pattern:
- Models (FacePayApp/models.py)
- Views (FacePayApp/views.py)
- URLs (routing layer)
- RESTful API architecture (shown by serializers.py)
- Containerization (Docker support)

##### Infrastructure Layer

Docker container architecture:
- Docker Compose services
- Network isolation
- Database persistence
- Application container

##### Key Features to Emphasize

- Facial Recognition System
- Wallet Integration
- Consumer Analytics
- Security Measures
- Payment Processing

Remember to include the project's USP elements and show how the architecture supports the key features mentioned in the README, such as swift checkout, security, and personalized shopping experiences.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UIP["User Information Portal"]:::frontend
        SIG["Smart Invoice Generator"]:::frontend
    end

    subgraph "Backend Layer"
        CoreApp["Core Application"]:::backend
        click CoreApp "https://github.com/AashishNandakumar/MiraPay-Backend/tree/main/FacePay"
        
        subgraph "Main Application"
            Models["Data Models"]:::backend
            click Models "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/FacePayApp/models.py"
            Views["Views Layer"]:::backend
            click Views "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/FacePayApp/views.py"
            URLs["URL Routing"]:::backend
            click URLs "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/FacePayApp/urls.py"
            Admin["Admin Interface"]:::backend
            click Admin "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/FacePayApp/admin.py"
            API["API Layer"]:::backend
            click API "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/FacePayApp/serializers.py"
        end

        subgraph "Utility Services"
            EmailSvc["Email Service"]:::utility
            click EmailSvc "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/FacePayApp/utils/emails.py"
            SMSSvc["SMS Service"]:::utility
            click SMSSvc "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/FacePayApp/utils/sms.py"
            PaymentProc["Payment Processing"]:::utility
            click PaymentProc "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/FacePayApp/utils/payments.py"
            FaceRec["Facial Recognition System"]:::utility
        end
    end

    subgraph "Database Layer"
        DB[(SQLite Database)]:::database
        click DB "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/db.sqlite3"
        Migrations["Database Migrations"]:::database
        click Migrations "https://github.com/AashishNandakumar/MiraPay-Backend/tree/main/FacePayApp/migrations"
    end

    subgraph "Infrastructure"
        Docker["Docker Container"]:::infra
        click Docker "https://github.com/AashishNandakumar/MiraPay-Backend/tree/main/Dockerfile"
        DockerCompose["Docker Compose"]:::infra
        click DockerCompose "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/docker-compose.yml"
        DBWait["Database Wait Script"]:::infra
        click DBWait "https://github.com/AashishNandakumar/MiraPay-Backend/blob/main/FacePayApp/management/commands/wait_for_db.py"
    end

    subgraph "External Services"
        PayGateway["Payment Gateway"]:::external
        CloudStorage["Cloud Storage"]:::external
        CommServices["Communication Services"]:::external
    end

    %% Frontend to Backend Connections
    UIP --> API
    SIG --> API

    %% Backend Internal Connections
    API --> Views
    Views --> Models
    Models --> DB
    CoreApp --> URLs
    URLs --> Views
    Admin --> Models

    %% Utility Services Connections
    Views --> EmailSvc
    Views --> SMSSvc
    Views --> PaymentProc
    Views --> FaceRec

    %% External Service Connections
    PaymentProc --> PayGateway
    FaceRec --> CloudStorage
    EmailSvc & SMSSvc --> CommServices

    %% Infrastructure Connections
    Docker --> CoreApp
    DockerCompose --> Docker
    DBWait --> DB

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef utility fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef infra fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        Backend_L["Backend"]:::backend
        Utility_L["Utility Services"]:::utility
        Database_L["Database"]:::database
        External_L["External Services"]:::external
        Infrastructure_L["Infrastructure"]:::infra
    end
```
