# mrfanasina/anime architecture

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

- Interactive diagram: https://gitdiagram.com/mrfanasina/anime
- Repository: https://github.com/mrfanasina/anime

## Overview

Anime Manager is a multi-client anime library and synchronization product: users browse and manage anime on the web or Android, while a FastAPI backend exposes shared catalog, watch, playback, download, and synchronization capabilities. The documented runtime also scans local media, enriches titles from MAL/AniList, and transfers files over the local network. Backend startup and Android’s local/PC catalog flow are visible in sampled source; several other capability links are based on the README and repository structure, whose implementation was not sampled.

Main entry points: [`backend/app/routers`](https://github.com/mrfanasina/anime/tree/main/backend/app/routers) (API route handlers), [`backend/main.py`](https://github.com/mrfanasina/anime/blob/main/backend/main.py) (FastAPI application), [`backend/app/db/session.py`](https://github.com/mrfanasina/anime/blob/main/backend/app/db/session.py) (Anime database), [`backend/app/utils/folder.py`](https://github.com/mrfanasina/anime/blob/main/backend/app/utils/folder.py) (Local media folders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_webapp["Web application<br/>[App.jsx]"]
  node_webpages["Catalog and watch pages"]
  node_webapi["Web API client<br/>[api.js]"]
  node_android["Android app<br/>[MainActivity.kt]"]
  node_androidhome["Local and PC catalog<br/>[HomeFragment.kt]"]
end

subgraph group_backend["Backend services"]
  node_api["FastAPI application<br/>[main.py]"]
  node_routes["API route handlers"]
  node_catalog["Anime and season data<br/>[anime.py]"]
  node_watch["Watch progress<br/>[watch.py]"]
  node_playback["Playback and downloads<br/>[player.py]"]
  node_sync["Disk synchronization<br/>[sync.py]"]
  node_enrichment["Anime metadata enrichment<br/>[get_anime_info.py]"]
end

subgraph group_local["Library and storage"]
  node_database[("Anime database<br/>[session.py]")]
  node_media["Local media folders<br/>[folder.py]"]
  node_diskmount["Disk mounting<br/>[mount.py]"]
end

subgraph group_external["External services"]
  node_mal["MAL and AniList"]
end

node_viewer(("Anime user"))
node_network(("Local network peer"))

node_viewer -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_webpages
node_webapp -->|"loads user"| node_webapi
node_webapi -->|"HTTP requests"| node_api
node_viewer -->|"uses"| node_android
node_android -->|"opens catalog"| node_androidhome
node_androidhome -->|"scans local"| node_media
node_androidhome -->|"fetches PC anime"| node_api
node_api -->|"dispatches"| node_routes
node_routes -->|"calls"| node_catalog
node_routes -->|"calls"| node_watch
node_routes -->|"dispatches"| node_playback
node_routes -->|"dispatches"| node_sync
node_routes -->|"dispatches"| node_enrichment
node_catalog -->|"reads/writes"| node_database
node_watch -->|"reads/writes"| node_database
node_sync -->|"scans and syncs"| node_media
node_sync -->|"updates records"| node_database
node_diskmount -->|"mounts"| node_media
node_api -->|"initializes"| node_database
node_enrichment -.->|"fetches metadata"| node_mal
node_network -->|"connects locally"| node_api
node_playback -->|"serves media"| node_media

click node_webapp "https://github.com/mrfanasina/anime/blob/main/web/src/App.jsx"
click node_webpages "https://github.com/mrfanasina/anime/tree/main/web/src/pages"
click node_webapi "https://github.com/mrfanasina/anime/blob/main/web/src/services/api.js"
click node_android "https://github.com/mrfanasina/anime/blob/main/mobile/app/src/main/java/com/fa/animesync/MainActivity.kt"
click node_androidhome "https://github.com/mrfanasina/anime/blob/main/mobile/app/src/main/java/com/fa/animesync/ui/home/HomeFragment.kt"
click node_api "https://github.com/mrfanasina/anime/blob/main/backend/main.py"
click node_routes "https://github.com/mrfanasina/anime/tree/main/backend/app/routers"
click node_catalog "https://github.com/mrfanasina/anime/blob/main/backend/app/crud/anime.py"
click node_watch "https://github.com/mrfanasina/anime/blob/main/backend/app/crud/watch.py"
click node_playback "https://github.com/mrfanasina/anime/blob/main/backend/app/routers/player.py"
click node_sync "https://github.com/mrfanasina/anime/blob/main/backend/app/sync.py"
click node_enrichment "https://github.com/mrfanasina/anime/blob/main/backend/app/utils/get_anime_info.py"
click node_database "https://github.com/mrfanasina/anime/blob/main/backend/app/db/session.py"
click node_media "https://github.com/mrfanasina/anime/blob/main/backend/app/utils/folder.py"
click node_diskmount "https://github.com/mrfanasina/anime/blob/main/backend/app/utils/mount.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_webapp,node_webpages,node_webapi,node_android,node_androidhome,node_viewer toneBlue
class node_api,node_routes,node_catalog,node_watch,node_playback,node_sync,node_enrichment toneAmber
class node_database,node_media,node_diskmount toneMint
class node_mal toneRose
class node_network toneIndigo
```

## Components

### User clients

- [Web application](https://github.com/mrfanasina/anime/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Catalog and watch pages](https://github.com/mrfanasina/anime/tree/main/web/src/pages): `web/src/pages`
- [Web API client](https://github.com/mrfanasina/anime/blob/main/web/src/services/api.js): `web/src/services/api.js`
- [Android app](https://github.com/mrfanasina/anime/blob/main/mobile/app/src/main/java/com/fa/animesync/MainActivity.kt): `mobile/app/src/main/java/com/fa/animesync/MainActivity.kt`
- [Local and PC catalog](https://github.com/mrfanasina/anime/blob/main/mobile/app/src/main/java/com/fa/animesync/ui/home/HomeFragment.kt): `mobile/app/src/main/java/com/fa/animesync/ui/home/HomeFragment.kt`

### Backend services

- [FastAPI application](https://github.com/mrfanasina/anime/blob/main/backend/main.py): `backend/main.py`
- [API route handlers](https://github.com/mrfanasina/anime/tree/main/backend/app/routers): `backend/app/routers`
- [Anime and season data](https://github.com/mrfanasina/anime/blob/main/backend/app/crud/anime.py): `backend/app/crud/anime.py`
- [Watch progress](https://github.com/mrfanasina/anime/blob/main/backend/app/crud/watch.py): `backend/app/crud/watch.py`
- [Playback and downloads](https://github.com/mrfanasina/anime/blob/main/backend/app/routers/player.py): `backend/app/routers/player.py`
- [Disk synchronization](https://github.com/mrfanasina/anime/blob/main/backend/app/sync.py): `backend/app/sync.py`
- [Anime metadata enrichment](https://github.com/mrfanasina/anime/blob/main/backend/app/utils/get_anime_info.py): `backend/app/utils/get_anime_info.py`

### Library and storage

- [Anime database](https://github.com/mrfanasina/anime/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Local media folders](https://github.com/mrfanasina/anime/blob/main/backend/app/utils/folder.py): `backend/app/utils/folder.py`
- [Disk mounting](https://github.com/mrfanasina/anime/blob/main/backend/app/utils/mount.py): `backend/app/utils/mount.py`

### External services

- **MAL and AniList**

### Other components

- **Anime user**
- **Local network peer**

## Connections

- Anime user → Web application: uses
- Web application → Catalog and watch pages: routes to
- Web application → Web API client: loads user
- Web API client → FastAPI application: HTTP requests
- Anime user → Android app: uses
- Android app → Local and PC catalog: opens catalog
- Local and PC catalog → Local media folders: scans local
- Local and PC catalog → FastAPI application: fetches PC anime
- FastAPI application → API route handlers: dispatches
- API route handlers → Anime and season data: calls
- API route handlers → Watch progress: calls
- API route handlers → Playback and downloads: dispatches
- API route handlers → Disk synchronization: dispatches
- API route handlers → Anime metadata enrichment: dispatches
- Anime and season data → Anime database: reads/writes
- Watch progress → Anime database: reads/writes
- Disk synchronization → Local media folders: scans and syncs
- Disk synchronization → Anime database: updates records
- Disk mounting → Local media folders: mounts
- FastAPI application → Anime database: initializes
- Anime metadata enrichment → MAL and AniList: fetches metadata
- Local network peer → FastAPI application: connects locally
- Playback and downloads → Local media folders: serves media
