# akvivoy17s-commits/animeottv3 architecture

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

- Interactive diagram: https://gitdiagram.com/akvivoy17s-commits/animeottv3
- Repository: https://github.com/akvivoy17s-commits/animeottv3

## Overview

The repository contains a Flutter project, but its Dart application sources are not present in the supplied tree. The inspectable product behavior is chiefly a FastAPI admin service that scans Google Drive videos, parses metadata, tracks resumable jobs, and uploads video records to Firestore (with a browser-upload mode). The graph follows that backend workflow; links are limited to relationships visible in excerpts or the SOURCE INDEX.

Main entry points: [`backend/drive_agent/agent.py`](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/agent.py) (Drive agent), [`backend/drive_agent/service.py`](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/service.py) (Run manager), [`backend/drive_agent/uploader.py`](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/uploader.py) (Upload dispatcher), [`backend/drive_agent/api.py`](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/api.py) (Admin API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Service entry"]
  node_fastapi["FastAPI app<br/>[main.py]"]
  node_routes["Admin API routes<br/>[api.py]"]
end

subgraph group_orchestration["Run orchestration"]
  node_manager["Run manager<br/>[service.py]"]
  node_agent["Drive agent<br/>[agent.py]"]
  node_state[("Job state store<br/>[state.py]")]
  node_models["Video and job models<br/>[models.py]"]
  node_config["Agent configuration<br/>[config.py]"]
  node_logging["Agent logging<br/>[log.py]"]
end

subgraph group_drive["Drive ingestion"]
  node_reader["Drive folder reader<br/>[drive_reader.py]"]
  node_parser["Metadata parser<br/>[parser.py]"]
end

subgraph group_upload["Upload and identity"]
  node_uploader["Upload dispatcher<br/>[uploader.py]"]
  node_browser["Browser uploader<br/>[browser.py]"]
  node_auth["Firebase admin guard<br/>[auth.py]"]
end

node_admin(("Admin operator"))
node_driveapi{{"Google Drive"}}
node_firestore[("Firebase Firestore")]
node_webapp(("Admin web app"))

node_admin -->|"starts upload"| node_webapp
node_webapp -.->|"calls API"| node_fastapi
node_fastapi -->|"registers routes"| node_routes
node_routes -->|"checks admin"| node_auth
node_routes -->|"delegates runs"| node_manager
node_manager -->|"starts work"| node_agent
node_manager -->|"builds config"| node_config
node_manager -->|"reads job state"| node_state
node_manager -->|"sets up logs"| node_logging
node_agent -->|"scans folder"| node_reader
node_agent -->|"parses metadata"| node_parser
node_agent -->|"claims and updates jobs"| node_state
node_agent -->|"uploads jobs"| node_uploader
node_agent -->|"uses settings"| node_config
node_agent -->|"logs progress"| node_logging
node_reader -->|"reads videos"| node_driveapi
node_reader -->|"creates video records"| node_models
node_parser -->|"produces metadata"| node_models
node_agent -->|"processes jobs"| node_models
node_uploader -->|"writes video docs"| node_firestore
node_uploader -->|"dispatches browser mode"| node_browser
node_uploader -->|"loads credentials"| node_auth
node_auth -->|"verifies admin role"| node_firestore

click node_fastapi "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/main.py"
click node_routes "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/api.py"
click node_manager "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/service.py"
click node_agent "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/agent.py"
click node_state "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/state.py"
click node_models "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/models.py"
click node_config "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/config.py"
click node_logging "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/log.py"
click node_reader "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/drive_reader.py"
click node_parser "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/parser.py"
click node_uploader "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/uploader.py"
click node_browser "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/browser.py"
click node_auth "https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/auth.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_fastapi,node_routes toneBlue
class node_manager,node_agent,node_state,node_models,node_config,node_logging,node_firestore toneAmber
class node_reader,node_parser toneMint
class node_uploader,node_browser,node_auth toneRose
class node_admin,node_driveapi,node_webapp toneIndigo
```

## Components

### Service entry

- [FastAPI app](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/main.py): `backend/main.py`
- [Admin API routes](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/api.py): `backend/drive_agent/api.py`

### Run orchestration

- [Run manager](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/service.py): `backend/drive_agent/service.py`
- [Drive agent](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/agent.py): `backend/drive_agent/agent.py`
- [Job state store](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/state.py): `backend/drive_agent/state.py`
- [Video and job models](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/models.py): `backend/drive_agent/models.py`
- [Agent configuration](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/config.py): `backend/drive_agent/config.py`
- [Agent logging](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/log.py): `backend/drive_agent/log.py`

### Drive ingestion

- [Drive folder reader](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/drive_reader.py): `backend/drive_agent/drive_reader.py`
- [Metadata parser](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/parser.py): `backend/drive_agent/parser.py`

### Upload and identity

- [Upload dispatcher](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/uploader.py): `backend/drive_agent/uploader.py`
- [Browser uploader](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/browser.py): `backend/drive_agent/browser.py`
- [Firebase admin guard](https://github.com/akvivoy17s-commits/animeottv3/blob/main/backend/drive_agent/auth.py): `backend/drive_agent/auth.py`

### Other components

- **Admin operator**
- **Google Drive**
- **Firebase Firestore**
- **Admin web app**

## Connections

- Admin operator → Admin web app: starts upload
- Admin web app → FastAPI app: calls API
- FastAPI app → Admin API routes: registers routes (evidence: `backend/main.py`)
- Admin API routes → Firebase admin guard: checks admin (evidence: `backend/drive_agent/api.py`)
- Admin API routes → Run manager: delegates runs (evidence: `backend/drive_agent/api.py`)
- Run manager → Drive agent: starts work (evidence: `backend/drive_agent/service.py`)
- Run manager → Agent configuration: builds config (evidence: `backend/drive_agent/service.py`)
- Run manager → Job state store: reads job state (evidence: `backend/drive_agent/service.py`)
- Run manager → Agent logging: sets up logs (evidence: `backend/drive_agent/service.py`)
- Drive agent → Drive folder reader: scans folder (evidence: `backend/drive_agent/agent.py`)
- Drive agent → Metadata parser: parses metadata (evidence: `backend/drive_agent/agent.py`)
- Drive agent → Job state store: claims and updates jobs (evidence: `backend/drive_agent/agent.py`)
- Drive agent → Upload dispatcher: uploads jobs (evidence: `backend/drive_agent/agent.py`)
- Drive agent → Agent configuration: uses settings (evidence: `backend/drive_agent/agent.py`)
- Drive agent → Agent logging: logs progress (evidence: `backend/drive_agent/agent.py`)
- Drive folder reader → Google Drive: reads videos (evidence: `backend/drive_agent/drive_reader.py`)
- Drive folder reader → Video and job models: creates video records (evidence: `backend/drive_agent/drive_reader.py`)
- Metadata parser → Video and job models: produces metadata (evidence: `backend/drive_agent/parser.py`)
- Drive agent → Video and job models: processes jobs (evidence: `backend/drive_agent/agent.py`)
- Upload dispatcher → Firebase Firestore: writes video docs (evidence: `backend/drive_agent/uploader.py`)
- Upload dispatcher → Browser uploader: dispatches browser mode (evidence: `backend/drive_agent/uploader.py`)
- Upload dispatcher → Firebase admin guard: loads credentials (evidence: `backend/drive_agent/uploader.py`)
- Firebase admin guard → Firebase Firestore: verifies admin role (evidence: `backend/drive_agent/auth.py`)
