# dertarzan/downloadpage architecture

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

- Interactive diagram: https://gitdiagram.com/dertarzan/downloadpage
- Repository: https://github.com/dertarzan/downloadpage

## Overview

This is a FastAPI backend for a database- and file-backed product/document platform. The principal workflow is browsing nested categories, products and their PDFs; administrators authenticate to manage that catalog and its files. The graph preserves the documented router→service→repository design, authentication, settings and storage. Some router implementations were not sampled, so those relationships are included only where the README or SOURCE INDEX supports them.

Main entry points: [`app/dependencies.py`](https://github.com/dertarzan/downloadpage/blob/master/app/dependencies.py) (Dependency and access checks), [`app/main.py`](https://github.com/dertarzan/downloadpage/blob/master/app/main.py) (Application setup), [`app/core/database.py`](https://github.com/dertarzan/downloadpage/blob/master/app/core/database.py) (SQLAlchemy sessions), [`app/services/category_service.py`](https://github.com/dertarzan/downloadpage/blob/master/app/services/category_service.py) (Category management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP and admin"]
  node_app["Application setup<br/>[main.py]"]
  node_public_routes["Public catalog routes<br/>[public.py]"]
  node_catalog_routes["Catalog admin routes<br/>[categories.py]"]
  node_product_routes["Product admin routes<br/>[products.py]"]
  node_document_routes["Document routes<br/>[documents.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_admin_routes["Admin pages<br/>[admin.py]"]
  node_admin_ui["Admin interface<br/>[admin.js]"]
end

subgraph group_domain["Catalog domain"]
  node_category_service["Category management"]
  node_product_service["Product management<br/>[product_service.py]"]
  node_document_service["Document management"]
end

subgraph group_identity["Identity and settings"]
  node_auth_service["Authentication logic<br/>[auth_service.py]"]
  node_settings_service["Site settings<br/>[setting_service.py]"]
  node_dependencies["Dependency and access checks<br/>[dependencies.py]"]
end

subgraph group_persistence["Persistence and storage"]
  node_category_repo["Category queries"]
  node_product_repo["Product queries"]
  node_document_repo["Document queries"]
  node_user_repo["User and session queries<br/>[user_repository.py]"]
  node_settings_repo["Settings queries"]
  node_file_service["File validation and storage<br/>[file_service.py]"]
  node_db[("SQLAlchemy sessions<br/>[database.py]")]
end

node_visitor(("Visitor"))
node_administrator(("Administrator"))
node_postgres[("PostgreSQL")]
node_filesystem[("File storage")]

node_visitor -->|"requests pages"| node_app
node_administrator -->|"uses admin"| node_app
node_app -->|"registers routes"| node_public_routes
node_app -->|"registers routes"| node_auth_routes
node_app -->|"registers routes"| node_admin_routes
node_app -->|"registers routes"| node_catalog_routes
node_app -->|"registers routes"| node_product_routes
node_app -->|"registers routes"| node_document_routes
node_admin_routes -.->|"serves admin"| node_admin_ui
node_public_routes -->|"uses dependencies"| node_dependencies
node_catalog_routes -->|"uses dependencies"| node_dependencies
node_product_routes -->|"uses dependencies"| node_dependencies
node_auth_routes -->|"uses dependencies"| node_dependencies
node_dependencies -->|"creates and validates"| node_auth_service
node_dependencies -->|"provides service"| node_category_service
node_dependencies -->|"provides service"| node_product_service
node_dependencies -->|"provides service"| node_document_service
node_dependencies -->|"provides service"| node_settings_service
node_category_service -->|"queries categories"| node_category_repo
node_category_service -->|"queries products"| node_product_repo
node_category_service -->|"queries documents"| node_document_repo
node_category_service -->|"manages images"| node_file_service
node_product_service -->|"checks categories"| node_category_repo
node_product_service -->|"queries products"| node_product_repo
node_product_service -->|"queries documents"| node_document_repo
node_product_service -->|"manages images"| node_file_service
node_document_service -->|"checks categories"| node_category_repo
node_document_service -->|"checks products"| node_product_repo
node_document_service -->|"queries documents"| node_document_repo
node_document_service -->|"stores files"| node_file_service
node_auth_service -->|"manages users"| node_user_repo
node_settings_service -->|"reads settings"| node_settings_repo
node_public_routes -->|"serves media"| node_file_service
node_category_repo -.->|"queries database"| node_db
node_product_repo -.->|"queries database"| node_db
node_document_repo -.->|"queries database"| node_db
node_user_repo -.->|"queries database"| node_db
node_settings_repo -.->|"queries database"| node_db
node_db -->|"connects to"| node_postgres
node_file_service -->|"reads and writes"| node_filesystem

click node_app "https://github.com/dertarzan/downloadpage/blob/master/app/main.py"
click node_public_routes "https://github.com/dertarzan/downloadpage/blob/master/app/routers/public.py"
click node_catalog_routes "https://github.com/dertarzan/downloadpage/blob/master/app/routers/categories.py"
click node_product_routes "https://github.com/dertarzan/downloadpage/blob/master/app/routers/products.py"
click node_document_routes "https://github.com/dertarzan/downloadpage/blob/master/app/routers/documents.py"
click node_auth_routes "https://github.com/dertarzan/downloadpage/blob/master/app/routers/auth.py"
click node_admin_routes "https://github.com/dertarzan/downloadpage/blob/master/app/routers/admin.py"
click node_admin_ui "https://github.com/dertarzan/downloadpage/blob/master/app/static/js/admin.js"
click node_category_service "https://github.com/dertarzan/downloadpage/blob/master/app/services/category_service.py"
click node_product_service "https://github.com/dertarzan/downloadpage/blob/master/app/services/product_service.py"
click node_document_service "https://github.com/dertarzan/downloadpage/blob/master/app/services/document_service.py"
click node_auth_service "https://github.com/dertarzan/downloadpage/blob/master/app/services/auth_service.py"
click node_settings_service "https://github.com/dertarzan/downloadpage/blob/master/app/services/setting_service.py"
click node_dependencies "https://github.com/dertarzan/downloadpage/blob/master/app/dependencies.py"
click node_category_repo "https://github.com/dertarzan/downloadpage/blob/master/app/repositories/category_repository.py"
click node_product_repo "https://github.com/dertarzan/downloadpage/blob/master/app/repositories/product_repository.py"
click node_document_repo "https://github.com/dertarzan/downloadpage/blob/master/app/repositories/document_repository.py"
click node_user_repo "https://github.com/dertarzan/downloadpage/blob/master/app/repositories/user_repository.py"
click node_settings_repo "https://github.com/dertarzan/downloadpage/blob/master/app/repositories/setting_repository.py"
click node_file_service "https://github.com/dertarzan/downloadpage/blob/master/app/services/file_service.py"
click node_db "https://github.com/dertarzan/downloadpage/blob/master/app/core/database.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_public_routes,node_catalog_routes,node_product_routes,node_document_routes,node_auth_routes,node_admin_routes,node_admin_ui toneBlue
class node_category_service,node_product_service,node_document_service,node_postgres,node_filesystem toneAmber
class node_auth_service,node_settings_service,node_dependencies toneMint
class node_category_repo,node_product_repo,node_document_repo,node_user_repo,node_settings_repo,node_file_service,node_db toneRose
class node_visitor,node_administrator toneIndigo
```

## Components

### HTTP and admin

- [Application setup](https://github.com/dertarzan/downloadpage/blob/master/app/main.py): `app/main.py`
- [Public catalog routes](https://github.com/dertarzan/downloadpage/blob/master/app/routers/public.py): `app/routers/public.py`
- [Catalog admin routes](https://github.com/dertarzan/downloadpage/blob/master/app/routers/categories.py): `app/routers/categories.py`
- [Product admin routes](https://github.com/dertarzan/downloadpage/blob/master/app/routers/products.py): `app/routers/products.py`
- [Document routes](https://github.com/dertarzan/downloadpage/blob/master/app/routers/documents.py): `app/routers/documents.py`
- [Authentication routes](https://github.com/dertarzan/downloadpage/blob/master/app/routers/auth.py): `app/routers/auth.py`
- [Admin pages](https://github.com/dertarzan/downloadpage/blob/master/app/routers/admin.py): `app/routers/admin.py`
- [Admin interface](https://github.com/dertarzan/downloadpage/blob/master/app/static/js/admin.js): `app/static/js/admin.js`

### Catalog domain

- [Category management](https://github.com/dertarzan/downloadpage/blob/master/app/services/category_service.py): `app/services/category_service.py`
- [Product management](https://github.com/dertarzan/downloadpage/blob/master/app/services/product_service.py): `app/services/product_service.py`
- [Document management](https://github.com/dertarzan/downloadpage/blob/master/app/services/document_service.py): `app/services/document_service.py`

### Identity and settings

- [Authentication logic](https://github.com/dertarzan/downloadpage/blob/master/app/services/auth_service.py): `app/services/auth_service.py`
- [Site settings](https://github.com/dertarzan/downloadpage/blob/master/app/services/setting_service.py): `app/services/setting_service.py`
- [Dependency and access checks](https://github.com/dertarzan/downloadpage/blob/master/app/dependencies.py): `app/dependencies.py`

### Persistence and storage

- [Category queries](https://github.com/dertarzan/downloadpage/blob/master/app/repositories/category_repository.py): `app/repositories/category_repository.py`
- [Product queries](https://github.com/dertarzan/downloadpage/blob/master/app/repositories/product_repository.py): `app/repositories/product_repository.py`
- [Document queries](https://github.com/dertarzan/downloadpage/blob/master/app/repositories/document_repository.py): `app/repositories/document_repository.py`
- [User and session queries](https://github.com/dertarzan/downloadpage/blob/master/app/repositories/user_repository.py): `app/repositories/user_repository.py`
- [Settings queries](https://github.com/dertarzan/downloadpage/blob/master/app/repositories/setting_repository.py): `app/repositories/setting_repository.py`
- [File validation and storage](https://github.com/dertarzan/downloadpage/blob/master/app/services/file_service.py): `app/services/file_service.py`
- [SQLAlchemy sessions](https://github.com/dertarzan/downloadpage/blob/master/app/core/database.py): `app/core/database.py`

### Other components

- **Visitor**
- **Administrator**
- **PostgreSQL**
- **File storage**

## Connections

- Visitor → Application setup: requests pages
- Administrator → Application setup: uses admin
- Application setup → Public catalog routes: registers routes (evidence: `app/main.py`)
- Application setup → Authentication routes: registers routes (evidence: `app/main.py`)
- Application setup → Admin pages: registers routes (evidence: `app/main.py`)
- Application setup → Catalog admin routes: registers routes (evidence: `app/main.py`)
- Application setup → Product admin routes: registers routes (evidence: `app/main.py`)
- Application setup → Document routes: registers routes (evidence: `app/main.py`)
- Admin pages → Admin interface: serves admin
- Public catalog routes → Dependency and access checks: uses dependencies (evidence: `app/routers/public.py`)
- Catalog admin routes → Dependency and access checks: uses dependencies (evidence: `app/routers/categories.py`)
- Product admin routes → Dependency and access checks: uses dependencies (evidence: `app/routers/products.py`)
- Authentication routes → Dependency and access checks: uses dependencies (evidence: `app/routers/auth.py`)
- Dependency and access checks → Authentication logic: creates and validates (evidence: `app/dependencies.py`)
- Dependency and access checks → Category management: provides service (evidence: `app/dependencies.py`)
- Dependency and access checks → Product management: provides service (evidence: `app/dependencies.py`)
- Dependency and access checks → Document management: provides service (evidence: `app/dependencies.py`)
- Dependency and access checks → Site settings: provides service (evidence: `app/dependencies.py`)
- Category management → Category queries: queries categories (evidence: `app/services/category_service.py`)
- Category management → Product queries: queries products (evidence: `app/services/category_service.py`)
- Category management → Document queries: queries documents (evidence: `app/services/category_service.py`)
- Category management → File validation and storage: manages images (evidence: `app/services/category_service.py`)
- Product management → Category queries: checks categories (evidence: `app/services/product_service.py`)
- Product management → Product queries: queries products (evidence: `app/services/product_service.py`)
- Product management → Document queries: queries documents (evidence: `app/services/product_service.py`)
- Product management → File validation and storage: manages images (evidence: `app/services/product_service.py`)
- Document management → Category queries: checks categories (evidence: `app/services/document_service.py`)
- Document management → Product queries: checks products (evidence: `app/services/document_service.py`)
- Document management → Document queries: queries documents (evidence: `app/services/document_service.py`)
- Document management → File validation and storage: stores files (evidence: `app/services/document_service.py`)
- Authentication logic → User and session queries: manages users (evidence: `app/services/auth_service.py`)
- Site settings → Settings queries: reads settings (evidence: `app/services/setting_service.py`)
- Public catalog routes → File validation and storage: serves media (evidence: `app/routers/public.py`)
- Category queries → SQLAlchemy sessions: queries database
- Product queries → SQLAlchemy sessions: queries database
- Document queries → SQLAlchemy sessions: queries database
- User and session queries → SQLAlchemy sessions: queries database
- Settings queries → SQLAlchemy sessions: queries database
- SQLAlchemy sessions → PostgreSQL: connects to
- File validation and storage → File storage: reads and writes (evidence: `app/services/file_service.py`)
