# lokesh081103/fast architecture

> Architecture diagram of the GitHub repository lokesh081103/fast, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lokesh081103/fast
- Repository: https://github.com/lokesh081103/fast

## Overview

fast is a PostgreSQL explorer and report generator with a Streamlit interface and a companion FastAPI service. Users authenticate, inspect tables and columns, then generate filtered reports or pivot-style summaries; API clients can request JSON or XLSX results. The app also exposes monthly summaries, data upload, custom SQL, and admin capabilities. The excerpts show selected UI and API-to-core calls, but not all feature implementations or database wiring, so unsampled links are omitted.

Main entry points: [`fast/app.py`](https://github.com/lokesh081103/fast/blob/main/fast/app.py) (Streamlit app), [`fast/api.py`](https://github.com/lokesh081103/fast/blob/main/fast/api.py) (REST API), [`fast/db_core.py`](https://github.com/lokesh081103/fast/blob/main/fast/db_core.py) (Query and pivot core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_streamlit["Streamlit app<br/>[app.py]"]
  node_rest_api["REST API<br/>[api.py]"]
end

subgraph group_access["Access control"]
  node_app_auth["App authentication<br/>[app.py]"]
  node_api_auth["API authentication<br/>[api.py]"]
  node_admin["Admin panel<br/>[app.py]"]
end

subgraph group_data["Data exploration"]
  node_table_discovery["Table discovery<br/>[api.py]"]
  node_report_builder["Report builder<br/>[app.py]"]
  node_custom_sql["Custom SQL<br/>[app.py]"]
  node_data_upload["Data upload<br/>[app.py]"]
end

subgraph group_analysis["Report analytics"]
  node_monthly_summary["Monthly summary<br/>[app.py]"]
  node_pivot_ui["Summary table UI<br/>[app.py]"]
  node_pivot_matrix["Pivot matrix<br/>[api.py]"]
  node_dpd_buckets["DPD buckets<br/>[db_core.py]"]
  node_efficiency_pivot["Efficiency pivot<br/>[api.py]"]
  node_flat_pivot["Flat pivot<br/>[api.py]"]
end

subgraph group_core["Shared data core"]
  node_db_core["Query and pivot core<br/>[db_core.py]"]
end

node_user(("User"))
node_api_client(("API client"))
node_postgres[("PostgreSQL")]

node_user -->|"uses"| node_streamlit
node_api_client -->|"requests"| node_rest_api
node_streamlit -->|"requires login"| node_app_auth
node_rest_api -->|"checks access"| node_api_auth
node_rest_api -->|"calls core"| node_db_core
node_streamlit -->|"uses shared core"| node_db_core
node_rest_api -->|"serves schema"| node_table_discovery
node_streamlit -->|"renders report flow"| node_report_builder
node_streamlit -->|"renders summary tab"| node_pivot_ui
node_pivot_ui -->|"builds pivot"| node_db_core
node_report_builder -.->|"fetches report data"| node_db_core
node_streamlit -->|"executes query"| node_custom_sql
node_streamlit -.->|"offers upload"| node_data_upload
node_streamlit -.->|"offers summary"| node_monthly_summary
node_streamlit -.->|"offers admin"| node_admin
node_rest_api -->|"routes matrix"| node_pivot_matrix
node_pivot_matrix -->|"builds matrix"| node_db_core
node_pivot_matrix -->|"adds buckets"| node_dpd_buckets
node_rest_api -->|"routes efficiency"| node_efficiency_pivot
node_efficiency_pivot -->|"builds efficiency pivot"| node_db_core
node_rest_api -->|"routes flat pivot"| node_flat_pivot
node_flat_pivot -->|"builds flat pivot"| node_db_core
node_db_core -.->|"queries database"| node_postgres

click node_streamlit "https://github.com/lokesh081103/fast/blob/main/fast/app.py"
click node_rest_api "https://github.com/lokesh081103/fast/blob/main/fast/api.py"
click node_app_auth "https://github.com/lokesh081103/fast/blob/main/fast/app.py"
click node_api_auth "https://github.com/lokesh081103/fast/blob/main/fast/api.py"
click node_table_discovery "https://github.com/lokesh081103/fast/blob/main/fast/api.py"
click node_report_builder "https://github.com/lokesh081103/fast/blob/main/fast/app.py"
click node_custom_sql "https://github.com/lokesh081103/fast/blob/main/fast/app.py"
click node_data_upload "https://github.com/lokesh081103/fast/blob/main/fast/app.py"
click node_monthly_summary "https://github.com/lokesh081103/fast/blob/main/fast/app.py"
click node_pivot_ui "https://github.com/lokesh081103/fast/blob/main/fast/app.py"
click node_pivot_matrix "https://github.com/lokesh081103/fast/blob/main/fast/api.py"
click node_dpd_buckets "https://github.com/lokesh081103/fast/blob/main/fast/db_core.py"
click node_efficiency_pivot "https://github.com/lokesh081103/fast/blob/main/fast/api.py"
click node_flat_pivot "https://github.com/lokesh081103/fast/blob/main/fast/api.py"
click node_admin "https://github.com/lokesh081103/fast/blob/main/fast/app.py"
click node_db_core "https://github.com/lokesh081103/fast/blob/main/fast/db_core.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_streamlit,node_rest_api,node_user,node_api_client toneBlue
class node_app_auth,node_api_auth,node_admin,node_postgres toneAmber
class node_table_discovery,node_report_builder,node_custom_sql,node_data_upload toneMint
class node_monthly_summary,node_pivot_ui,node_pivot_matrix,node_dpd_buckets,node_efficiency_pivot,node_flat_pivot toneRose
class node_db_core toneIndigo
```

## Components

### User interfaces

- [Streamlit app](https://github.com/lokesh081103/fast/blob/main/fast/app.py): `fast/app.py`
- [REST API](https://github.com/lokesh081103/fast/blob/main/fast/api.py): `fast/api.py`

### Access control

- [App authentication](https://github.com/lokesh081103/fast/blob/main/fast/app.py): `fast/app.py`
- [API authentication](https://github.com/lokesh081103/fast/blob/main/fast/api.py): `fast/api.py`
- [Admin panel](https://github.com/lokesh081103/fast/blob/main/fast/app.py): `fast/app.py`

### Data exploration

- [Table discovery](https://github.com/lokesh081103/fast/blob/main/fast/api.py): `fast/api.py`
- [Report builder](https://github.com/lokesh081103/fast/blob/main/fast/app.py): `fast/app.py`
- [Custom SQL](https://github.com/lokesh081103/fast/blob/main/fast/app.py): `fast/app.py`
- [Data upload](https://github.com/lokesh081103/fast/blob/main/fast/app.py): `fast/app.py`

### Report analytics

- [Monthly summary](https://github.com/lokesh081103/fast/blob/main/fast/app.py): `fast/app.py`
- [Summary table UI](https://github.com/lokesh081103/fast/blob/main/fast/app.py): `fast/app.py`
- [Pivot matrix](https://github.com/lokesh081103/fast/blob/main/fast/api.py): `fast/api.py`
- [DPD buckets](https://github.com/lokesh081103/fast/blob/main/fast/db_core.py): `fast/db_core.py`
- [Efficiency pivot](https://github.com/lokesh081103/fast/blob/main/fast/api.py): `fast/api.py`
- [Flat pivot](https://github.com/lokesh081103/fast/blob/main/fast/api.py): `fast/api.py`

### Shared data core

- [Query and pivot core](https://github.com/lokesh081103/fast/blob/main/fast/db_core.py): `fast/db_core.py`

### Other components

- **User**
- **API client**
- **PostgreSQL**

## Connections

- User → Streamlit app: uses (evidence: `fast/app.py`)
- API client → REST API: requests (evidence: `fast/api.py`)
- Streamlit app → App authentication: requires login (evidence: `fast/app.py`)
- REST API → API authentication: checks access (evidence: `fast/api.py`)
- REST API → Query and pivot core: calls core (evidence: `fast/api.py`)
- Streamlit app → Query and pivot core: uses shared core (evidence: `fast/app.py`)
- REST API → Table discovery: serves schema (evidence: `fast/api.py`)
- Streamlit app → Report builder: renders report flow (evidence: `fast/app.py`)
- Streamlit app → Summary table UI: renders summary tab (evidence: `fast/app.py`)
- Summary table UI → Query and pivot core: builds pivot (evidence: `fast/app.py`)
- Report builder → Query and pivot core: fetches report data (evidence: `fast/app.py`)
- Streamlit app → Custom SQL: executes query (evidence: `fast/app.py`)
- Streamlit app → Data upload: offers upload (evidence: `fast/app.py`)
- Streamlit app → Monthly summary: offers summary (evidence: `fast/app.py`)
- Streamlit app → Admin panel: offers admin (evidence: `fast/app.py`)
- REST API → Pivot matrix: routes matrix (evidence: `fast/api.py`)
- Pivot matrix → Query and pivot core: builds matrix (evidence: `fast/api.py`)
- Pivot matrix → DPD buckets: adds buckets (evidence: `fast/api.py`)
- REST API → Efficiency pivot: routes efficiency (evidence: `fast/api.py`)
- Efficiency pivot → Query and pivot core: builds efficiency pivot (evidence: `fast/api.py`)
- REST API → Flat pivot: routes flat pivot (evidence: `fast/api.py`)
- Flat pivot → Query and pivot core: builds flat pivot (evidence: `fast/api.py`)
- Query and pivot core → PostgreSQL: queries database
