# vh1dzdev/graphlogger architecture

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

- Interactive diagram: https://gitdiagram.com/vh1dzdev/graphlogger
- Repository: https://github.com/vh1dzdev/graphlogger

## Overview

GraphLogger is a small FastAPI service for creating logger IDs, recording IP-addressed visits, retrieving logs, and deleting log records. A client reaches the API routes, which delegate operations to the SQLite-backed Logger; the app initializes the database at startup. The route code also defines a root redirect to the FastAPI docs. The supplied excerpts show response schemas and a token request model, but do not show token validation; the database file is created at runtime and is not in the repository tree.

Main entry points: [`src/api/routes.py`](https://github.com/vh1dzdev/graphlogger/blob/main/src/api/routes.py) (API routes), [`config.py`](https://github.com/vh1dzdev/graphlogger/blob/main/config.py) (Database path), [`main.py`](https://github.com/vh1dzdev/graphlogger/blob/main/main.py) (FastAPI app), [`utils/sql.py`](https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py) (Create logger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_app["FastAPI app<br/>[main.py]"]
end

subgraph group_api["HTTP API"]
  node_routes["API routes<br/>[routes.py]"]
  node_auth_model["Token model<br/>[classes.py]"]
  node_response_schemas["Response schemas<br/>[misc.py]"]
end

subgraph group_persistence["Persistence"]
  node_create_logger["Create logger<br/>[sql.py]"]
  node_record_visit["Record visit<br/>[sql.py]"]
  node_delete_logs["Delete logs<br/>[sql.py]"]
  node_retrieve_logs["Retrieve logs<br/>[sql.py]"]
  node_db_init["Database initialization<br/>[sql.py]"]
  node_db_config["Database path<br/>[config.py]"]
  node_sqlite[("SQLite database")]
end

node_client(("API client"))

node_client -->|"opens docs"| node_app
node_client -->|"calls endpoints"| node_routes
node_app -->|"mounts router"| node_routes
node_app -->|"initializes at startup"| node_db_init
node_routes -->|"parses token model"| node_auth_model
node_routes -->|"uses response schemas"| node_response_schemas
node_routes -->|"creates logger"| node_create_logger
node_routes -->|"records visit"| node_record_visit
node_routes -->|"deletes logs"| node_delete_logs
node_routes -->|"retrieves logs"| node_retrieve_logs
node_db_init -->|"reads path"| node_db_config
node_create_logger -->|"reads path"| node_db_config
node_record_visit -->|"reads path"| node_db_config
node_delete_logs -->|"reads path"| node_db_config
node_retrieve_logs -->|"reads path"| node_db_config
node_db_init -->|"creates tables"| node_sqlite
node_create_logger -->|"writes logger"| node_sqlite
node_record_visit -->|"checks and writes"| node_sqlite
node_delete_logs -->|"deletes records"| node_sqlite
node_retrieve_logs -->|"queries records"| node_sqlite

click node_app "https://github.com/vh1dzdev/graphlogger/blob/main/main.py"
click node_routes "https://github.com/vh1dzdev/graphlogger/blob/main/src/api/routes.py"
click node_auth_model "https://github.com/vh1dzdev/graphlogger/blob/main/src/api/classes.py"
click node_response_schemas "https://github.com/vh1dzdev/graphlogger/blob/main/src/api/misc.py"
click node_create_logger "https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py"
click node_record_visit "https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py"
click node_delete_logs "https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py"
click node_retrieve_logs "https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py"
click node_db_init "https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py"
click node_db_config "https://github.com/vh1dzdev/graphlogger/blob/main/config.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_app,node_client toneBlue
class node_routes,node_auth_model,node_response_schemas toneAmber
class node_create_logger,node_record_visit,node_delete_logs,node_retrieve_logs,node_db_init,node_db_config,node_sqlite toneMint
```

## Components

### Application runtime

- [FastAPI app](https://github.com/vh1dzdev/graphlogger/blob/main/main.py): `main.py`

### HTTP API

- [API routes](https://github.com/vh1dzdev/graphlogger/blob/main/src/api/routes.py): `src/api/routes.py`
- [Token model](https://github.com/vh1dzdev/graphlogger/blob/main/src/api/classes.py): `src/api/classes.py`
- [Response schemas](https://github.com/vh1dzdev/graphlogger/blob/main/src/api/misc.py): `src/api/misc.py`

### Persistence

- [Create logger](https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py): `utils/sql.py`
- [Record visit](https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py): `utils/sql.py`
- [Delete logs](https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py): `utils/sql.py`
- [Retrieve logs](https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py): `utils/sql.py`
- [Database initialization](https://github.com/vh1dzdev/graphlogger/blob/main/utils/sql.py): `utils/sql.py`
- [Database path](https://github.com/vh1dzdev/graphlogger/blob/main/config.py): `config.py`
- **SQLite database**

### Other components

- **API client**

## Connections

- API client → FastAPI app: opens docs (evidence: `main.py`)
- API client → API routes: calls endpoints (evidence: `src/api/routes.py`)
- FastAPI app → API routes: mounts router (evidence: `main.py`)
- FastAPI app → Database initialization: initializes at startup (evidence: `main.py`)
- API routes → Token model: parses token model (evidence: `src/api/routes.py`)
- API routes → Response schemas: uses response schemas (evidence: `src/api/routes.py`)
- API routes → Create logger: creates logger (evidence: `src/api/routes.py`)
- API routes → Record visit: records visit (evidence: `src/api/routes.py`)
- API routes → Delete logs: deletes logs (evidence: `src/api/routes.py`)
- API routes → Retrieve logs: retrieves logs (evidence: `src/api/routes.py`)
- Database initialization → Database path: reads path (evidence: `utils/sql.py`)
- Create logger → Database path: reads path (evidence: `utils/sql.py`)
- Record visit → Database path: reads path (evidence: `utils/sql.py`)
- Delete logs → Database path: reads path (evidence: `utils/sql.py`)
- Retrieve logs → Database path: reads path (evidence: `utils/sql.py`)
- Database initialization → SQLite database: creates tables (evidence: `utils/sql.py`)
- Create logger → SQLite database: writes logger (evidence: `utils/sql.py`)
- Record visit → SQLite database: checks and writes (evidence: `utils/sql.py`)
- Delete logs → SQLite database: deletes records (evidence: `utils/sql.py`)
- Retrieve logs → SQLite database: queries records (evidence: `utils/sql.py`)
