# kirill77karp/fileconv architecture

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

- Interactive diagram: https://gitdiagram.com/kirill77karp/fileconv
- Repository: https://github.com/kirill77karp/fileconv

## Overview

FileConv is a file-conversion API: users authenticate, submit a file and target format, and receive a task they can track and later download or delete. The API stores uploads and task records, then dispatches conversion asynchronously; a Celery worker selects a converter and records completion or failure. Conversion covers images, documents, and spreadsheets. The source excerpts show these runtime calls and configuration; the README is empty, so broader product claims are limited to the code shown.

Main entry points: [`src/api.py`](https://github.com/kirill77karp/fileconv/blob/main/src/api.py) (REST routes), [`src/worker.py`](https://github.com/kirill77karp/fileconv/blob/main/src/worker.py) (Celery task), [`src/converters.py`](https://github.com/kirill77karp/fileconv/blob/main/src/converters.py) (Format dispatcher), [`src/database.py`](https://github.com/kirill77karp/fileconv/blob/main/src/database.py) (Database sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_routes["REST routes<br/>[api.py]"]
  node_auth["JWT user lookup<br/>[dependencies.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
end

subgraph group_jobs["Conversion jobs"]
  node_celery["Celery task<br/>[worker.py]"]
  node_dispatcher["Format dispatcher<br/>[converters.py]"]
  node_images["Image conversion<br/>[converters.py]"]
  node_documents["Document conversion<br/>[converters.py]"]
  node_tables["Spreadsheet conversion<br/>[converters.py]"]
end

subgraph group_persistence["Persistence"]
  node_models["User and task models<br/>[models.py]"]
  node_database["Database sessions<br/>[database.py]"]
  node_storage[("Local file storage<br/>[storage.py]")]
end

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

node_user(("API user"))
node_postgres[("PostgreSQL")]
node_broker["Redis broker"]

node_user -->|"calls API"| node_app
node_app -->|"mounts routes"| node_routes
node_app -->|"initializes tables"| node_database
node_app -->|"reads prefix"| node_config
node_routes -->|"validates and serializes"| node_schemas
node_routes -->|"authenticates protected routes"| node_auth
node_routes -->|"queries and saves records"| node_database
node_routes -->|"creates and queries"| node_models
node_routes -->|"saves and deletes files"| node_storage
node_routes -->|"dispatches task"| node_celery
node_auth -->|"gets session"| node_database
node_auth -->|"looks up user"| node_models
node_database -->|"connects to"| node_postgres
node_celery -->|"configures broker"| node_broker
node_celery -->|"loads and updates task"| node_database
node_celery -->|"updates task status"| node_models
node_celery -->|"creates result path"| node_storage
node_celery -->|"converts file"| node_dispatcher
node_dispatcher -->|"dispatches image pairs"| node_images
node_dispatcher -->|"dispatches document pairs"| node_documents
node_dispatcher -->|"dispatches table pairs"| node_tables
node_dispatcher -->|"copies fallback files"| node_storage
node_routes -->|"checks upload limits"| node_config
node_celery -->|"reads broker settings"| node_config

click node_app "https://github.com/kirill77karp/fileconv/blob/main/src/main.py"
click node_routes "https://github.com/kirill77karp/fileconv/blob/main/src/api.py"
click node_auth "https://github.com/kirill77karp/fileconv/blob/main/src/dependencies.py"
click node_schemas "https://github.com/kirill77karp/fileconv/blob/main/src/schemas.py"
click node_models "https://github.com/kirill77karp/fileconv/blob/main/src/models.py"
click node_database "https://github.com/kirill77karp/fileconv/blob/main/src/database.py"
click node_storage "https://github.com/kirill77karp/fileconv/blob/main/src/storage.py"
click node_celery "https://github.com/kirill77karp/fileconv/blob/main/src/worker.py"
click node_dispatcher "https://github.com/kirill77karp/fileconv/blob/main/src/converters.py"
click node_images "https://github.com/kirill77karp/fileconv/blob/main/src/converters.py"
click node_documents "https://github.com/kirill77karp/fileconv/blob/main/src/converters.py"
click node_tables "https://github.com/kirill77karp/fileconv/blob/main/src/converters.py"
click node_config "https://github.com/kirill77karp/fileconv/blob/main/src/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_routes,node_auth,node_schemas,node_user toneBlue
class node_celery,node_dispatcher,node_images,node_documents,node_tables,node_postgres,node_broker toneAmber
class node_models,node_database,node_storage toneMint
class node_app,node_config toneRose
```

## Components

### API and identity

- [REST routes](https://github.com/kirill77karp/fileconv/blob/main/src/api.py): `src/api.py`
- [JWT user lookup](https://github.com/kirill77karp/fileconv/blob/main/src/dependencies.py): `src/dependencies.py`
- [Request and response schemas](https://github.com/kirill77karp/fileconv/blob/main/src/schemas.py): `src/schemas.py`

### Conversion jobs

- [Celery task](https://github.com/kirill77karp/fileconv/blob/main/src/worker.py): `src/worker.py`
- [Format dispatcher](https://github.com/kirill77karp/fileconv/blob/main/src/converters.py): `src/converters.py`
- [Image conversion](https://github.com/kirill77karp/fileconv/blob/main/src/converters.py): `src/converters.py`
- [Document conversion](https://github.com/kirill77karp/fileconv/blob/main/src/converters.py): `src/converters.py`
- [Spreadsheet conversion](https://github.com/kirill77karp/fileconv/blob/main/src/converters.py): `src/converters.py`

### Persistence

- [User and task models](https://github.com/kirill77karp/fileconv/blob/main/src/models.py): `src/models.py`
- [Database sessions](https://github.com/kirill77karp/fileconv/blob/main/src/database.py): `src/database.py`
- [Local file storage](https://github.com/kirill77karp/fileconv/blob/main/src/storage.py): `src/storage.py`

### Application runtime

- [FastAPI app](https://github.com/kirill77karp/fileconv/blob/main/src/main.py): `src/main.py`
- [Settings](https://github.com/kirill77karp/fileconv/blob/main/src/config.py): `src/config.py`

### Other components

- **API user**
- **PostgreSQL**
- **Redis broker**

## Connections

- API user → FastAPI app: calls API (evidence: `src/main.py`)
- FastAPI app → REST routes: mounts routes (evidence: `src/main.py`)
- FastAPI app → Database sessions: initializes tables (evidence: `src/main.py`)
- FastAPI app → Settings: reads prefix (evidence: `src/main.py`)
- REST routes → Request and response schemas: validates and serializes (evidence: `src/api.py`)
- REST routes → JWT user lookup: authenticates protected routes (evidence: `src/api.py`)
- REST routes → Database sessions: queries and saves records (evidence: `src/api.py`)
- REST routes → User and task models: creates and queries (evidence: `src/api.py`)
- REST routes → Local file storage: saves and deletes files (evidence: `src/api.py`)
- REST routes → Celery task: dispatches task (evidence: `src/api.py`)
- JWT user lookup → Database sessions: gets session (evidence: `src/dependencies.py`)
- JWT user lookup → User and task models: looks up user (evidence: `src/dependencies.py`)
- Database sessions → PostgreSQL: connects to (evidence: `src/database.py`)
- Celery task → Redis broker: configures broker (evidence: `src/worker.py`)
- Celery task → Database sessions: loads and updates task (evidence: `src/worker.py`)
- Celery task → User and task models: updates task status (evidence: `src/worker.py`)
- Celery task → Local file storage: creates result path (evidence: `src/worker.py`)
- Celery task → Format dispatcher: converts file (evidence: `src/worker.py`)
- Format dispatcher → Image conversion: dispatches image pairs (evidence: `src/converters.py`)
- Format dispatcher → Document conversion: dispatches document pairs (evidence: `src/converters.py`)
- Format dispatcher → Spreadsheet conversion: dispatches table pairs (evidence: `src/converters.py`)
- Format dispatcher → Local file storage: copies fallback files (evidence: `src/converters.py`)
- REST routes → Settings: checks upload limits (evidence: `src/api.py`)
- Celery task → Settings: reads broker settings (evidence: `src/worker.py`)
