# asehmi/fastapi-wrapper-apiness architecture

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

- Interactive diagram: https://gitdiagram.com/asehmi/fastapi-wrapper-apiness
- Repository: https://github.com/asehmi/fastapi-wrapper-apiness

## Overview

##### Main System Components

a) Core Components:
- FastAPI Wrapper Service
- Streamlit Web Interface
- SQLite Database Layer
- File Processing System

b) External Interfaces:
- REST API Endpoints
- File Upload Interface
- Database Download Interface

**1. Streamlit Interface:**
- File Upload Component
- Configuration Interface
- API Management Controls

**2. FastAPI Wrapper Core:**
- API Route Generator
- Query Parameter Handler
- Response Formatter (JSON/HTML)
- Security Layer (SQL Injection Prevention)

**3. Data Processing:**
- File Parser (CSV/XLSX)
- Database Generator
- Configuration Manager

##### Important Details

a) Process Flows:
- File Upload → Processing → Database Creation → API Generation
- API Request → Query Processing → Database Query → Response Formation

b) Key Integration Points:
- FastAPI to SQLite connection
- Streamlit to FastAPI communication
- External client access points

##### Technical Specifications

- Supported file formats (CSV, XLSX)
- Database types (SQLite)
- API endpoint patterns
- Query parameter types

##### Deployment Context

How the system can be:
- Run locally
- Deployed to cloud services
- Integrated with external systems

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Client Layer"
        PBI["Power BI"]
        Excel["Excel"]
        Browser["Web Browser"]
    end

    subgraph "Application Layer"
        subgraph "Streamlit Interface"
            SI["Streamlit App"]:::ui
            click SI "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/app.py"
            FC["File Upload Component"]:::ui
            CI["Configuration Interface"]:::ui
            AMC["API Management Controls"]:::ui
        end

        subgraph "FastAPI Wrapper Core"
            FW["FastAPI Wrapper"]:::core
            click FW "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/fastapi_wrapper/fastapi_wrapper.py"
            ARG["API Route Generator"]:::core
            QPH["Query Parameter Handler"]:::core
            RF["Response Formatter"]:::core
            click RF "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/fastapi_wrapper/html_helper.py"
            SL["Security Layer"]:::core
            CLI["CLI Interface"]:::core
            click CLI "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/fastapi_wrapper/cli.py"
            FE["FastAPI Extensions"]:::core
            click FE "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/utils/fastapi_patch.py"
        end

        subgraph "Data Processing"
            FP["File Parser"]:::process
            click FP "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/data.py"
            DG["Database Generator"]:::process
            CM["Configuration Manager"]:::process
            click CM "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/settings/settings.py"
            UF["Utility Functions"]:::process
            click UF "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/utils/common.py"
            SC["Server Configuration"]:::process
            click SC "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/utils/UvicornServer.py"
            BS["Application Bootstrap"]:::process
            click BS "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/bootstrapper.py"
        end
    end

    subgraph "Storage Layer"
        DB["SQLite Databases"]:::storage
        click DB "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/sql_db/apiness_routes_config.db"
        RC["Routes Configuration"]:::storage
        TS["Temporary Storage"]:::storage
        SD["Sample Data"]:::storage
        click SD "https://github.com/asehmi/fastapi-wrapper-apiness/tree/main/data/"
        ES["Environment Settings"]:::storage
        click ES "https://github.com/asehmi/fastapi-wrapper-apiness/blob/main/settings/env.local"
    end

    %% Connections
    PBI --> FW
    Excel --> FW
    Browser --> SI
    Browser --> FW

    SI --> FC
    SI --> CI
    SI --> AMC

    FC -.-> FP
    FP -.-> DG
    DG -.-> DB
    
    FW --> ARG
    FW --> QPH
    FW --> RF
    FW --> SL
    FW --> CLI
    FW --> FE

    ARG --> DB
    QPH --> DB
    RF --> DB

    CM --> RC
    UF --> FW
    SC --> FW
    BS --> FW

    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef process fill:#e67e22,stroke:#d35400,color:white
    classDef storage fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        UI["UI Component"]:::ui
        CORE["Core Component"]:::core
        PROC["Processing Component"]:::process
        STOR["Storage Component"]:::storage
    end
```
