# aftercoma/api_proxy architecture

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

- Interactive diagram: https://gitdiagram.com/aftercoma/api_proxy
- Repository: https://github.com/aftercoma/api_proxy

## Overview

Projek_api collects proxy records from an external listing, stores them in SQLite, and serves them through Flask JSON endpoints; its root route also renders a page. The scraper initializes the table before inserting parsed rows. The API independently queries the same database for all proxies or one random proxy. The README provides no additional capability details, so this map is based on the sampled source; the database display script is omitted as a peripheral inspection utility.

Main entry points: [`api.py`](https://github.com/aftercoma/api_proxy/blob/master/api.py) (Flask routes), [`scrap.py`](https://github.com/aftercoma/api_proxy/blob/master/scrap.py) (Scraper and parser), [`proxies.db`](https://github.com/aftercoma/api_proxy/blob/master/proxies.db) (Proxy database), [`database/db.py`](https://github.com/aftercoma/api_proxy/blob/master/database/db.py) (Schema setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Proxy collection"]
  node_scraper["Scraper and parser<br/>[scrap.py]"]
end

subgraph group_storage["SQLite storage"]
  node_schema["Schema setup<br/>[db.py]"]
  node_proxydb[("Proxy database<br/>[proxies.db]")]
end

subgraph group_serving["Web API"]
  node_flaskapi["Flask routes<br/>[api.py]"]
  node_webpage["Home page<br/>[index.html]"]
end

node_listing(("Proxy listing"))
node_client(("API client"))

node_scraper -->|"fetches listing"| node_listing
node_scraper -->|"initializes schema"| node_schema
node_schema -->|"creates table"| node_proxydb
node_scraper -->|"inserts proxies"| node_proxydb
node_flaskapi -->|"queries proxies"| node_proxydb
node_flaskapi -->|"renders page"| node_webpage
node_client -->|"requests routes"| node_flaskapi
node_flaskapi -->|"returns JSON"| node_client

click node_scraper "https://github.com/aftercoma/api_proxy/blob/master/scrap.py"
click node_schema "https://github.com/aftercoma/api_proxy/blob/master/database/db.py"
click node_proxydb "https://github.com/aftercoma/api_proxy/blob/master/proxies.db"
click node_flaskapi "https://github.com/aftercoma/api_proxy/blob/master/api.py"
click node_webpage "https://github.com/aftercoma/api_proxy/blob/master/templates/index.html"

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_scraper,node_client toneBlue
class node_schema,node_proxydb toneAmber
class node_flaskapi,node_webpage toneMint
class node_listing toneIndigo
```

## Components

### Proxy collection

- [Scraper and parser](https://github.com/aftercoma/api_proxy/blob/master/scrap.py): `scrap.py`

### SQLite storage

- [Schema setup](https://github.com/aftercoma/api_proxy/blob/master/database/db.py): `database/db.py`
- [Proxy database](https://github.com/aftercoma/api_proxy/blob/master/proxies.db): `proxies.db`

### Web API

- [Flask routes](https://github.com/aftercoma/api_proxy/blob/master/api.py): `api.py`
- [Home page](https://github.com/aftercoma/api_proxy/blob/master/templates/index.html): `templates/index.html`

### Other components

- **Proxy listing**
- **API client**

## Connections

- Scraper and parser → Proxy listing: fetches listing (evidence: `scrap.py`)
- Scraper and parser → Schema setup: initializes schema (evidence: `scrap.py`)
- Schema setup → Proxy database: creates table (evidence: `database/db.py`)
- Scraper and parser → Proxy database: inserts proxies (evidence: `scrap.py`)
- Flask routes → Proxy database: queries proxies (evidence: `api.py`)
- Flask routes → Home page: renders page (evidence: `api.py`)
- API client → Flask routes: requests routes (evidence: `api.py`)
- Flask routes → API client: returns JSON (evidence: `api.py`)
