# noryaren/diarflix architecture

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

- Interactive diagram: https://gitdiagram.com/noryaren/diarflix
- Repository: https://github.com/noryaren/diarflix

## Overview

Diarflix is a self-hosted film and series player. Users load the browser player, browse or search the library, then stream media with subtitles and saved per-user progress; administrators can scan media and manage users and metadata. The graph follows the documented SPA/API workflow and the sampled front-controller, authentication, scanner, and streaming code. Some client-side and API internals are unsampled, so those relationships are included only where documented.

Main entry points: [`public/index.php`](https://github.com/noryaren/diarflix/blob/main/public/index.php) (HTTP front controller), [`app/api.php`](https://github.com/noryaren/diarflix/blob/main/app/api.php) (Browse & admin API), [`app/scanner.php`](https://github.com/noryaren/diarflix/blob/main/app/scanner.php) (Library scanner), [`app/bootstrap.php`](https://github.com/noryaren/diarflix/blob/main/app/bootstrap.php) (Application bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_front["HTTP front controller<br/>[index.php]"]
  node_shell["SPA shell<br/>[shell.php]"]
  node_player["Browser player<br/>[app.js]"]
end

subgraph group_backend["Application backend"]
  node_api["Browse &amp; admin API<br/>[api.php]"]
  node_auth["JWT authentication<br/>[auth.php]"]
  node_bootstrap["Application bootstrap<br/>[bootstrap.php]"]
  node_helpers["Application helpers<br/>[helpers.php]"]
end

subgraph group_library["Media library"]
  node_scanner["Library scanner<br/>[scanner.php]"]
  node_stream["Media &amp; subtitle delivery<br/>[stream.php]"]
  node_mediafiles[("Media files")]
  node_subtitletools["ffmpeg / ffprobe"]
end

subgraph group_state["Persistent state"]
  node_dbconn["Database connection<br/>[db.php]"]
  node_database[("MariaDB / MySQL")]
  node_coverstore[("Poster uploads")]
end

node_viewer(("Viewer / admin"))

node_viewer -->|"opens player"| node_front
node_front -->|"loads"| node_bootstrap
node_bootstrap -->|"loads"| node_helpers
node_bootstrap -->|"loads"| node_dbconn
node_bootstrap -->|"loads"| node_auth
node_front -->|"renders"| node_shell
node_shell -->|"loads"| node_player
node_player -->|"requests data"| node_api
node_front -->|"dispatches API"| node_api
node_api -->|"checks identity"| node_auth
node_auth -->|"queries users"| node_dbconn
node_api -->|"reads and writes"| node_dbconn
node_dbconn -->|"connects"| node_database
node_player -->|"requests streams"| node_front
node_front -->|"routes media"| node_stream
node_stream -->|"serves ranges"| node_mediafiles
node_stream -->|"looks up posters"| node_database
node_front -->|"loads scanner"| node_scanner
node_api -.->|"starts web scan"| node_scanner
node_viewer -->|"runs CLI scan"| node_scanner
node_scanner -->|"scans files"| node_mediafiles
node_scanner -->|"updates library"| node_database
node_scanner -->|"extracts subtitles"| node_subtitletools
node_api -->|"saves posters"| node_coverstore

click node_front "https://github.com/noryaren/diarflix/blob/main/public/index.php"
click node_shell "https://github.com/noryaren/diarflix/blob/main/app/views/shell.php"
click node_player "https://github.com/noryaren/diarflix/blob/main/public/assets/app.js"
click node_api "https://github.com/noryaren/diarflix/blob/main/app/api.php"
click node_auth "https://github.com/noryaren/diarflix/blob/main/app/auth.php"
click node_bootstrap "https://github.com/noryaren/diarflix/blob/main/app/bootstrap.php"
click node_helpers "https://github.com/noryaren/diarflix/blob/main/app/helpers.php"
click node_dbconn "https://github.com/noryaren/diarflix/blob/main/app/db.php"
click node_scanner "https://github.com/noryaren/diarflix/blob/main/app/scanner.php"
click node_stream "https://github.com/noryaren/diarflix/blob/main/app/stream.php"
click node_coverstore "https://github.com/noryaren/diarflix/tree/main/storage/covers"

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_front,node_shell,node_player,node_viewer toneBlue
class node_api,node_auth,node_bootstrap,node_helpers toneAmber
class node_scanner,node_stream,node_mediafiles,node_subtitletools toneMint
class node_dbconn,node_database,node_coverstore toneRose
```

## Components

### Web experience

- [HTTP front controller](https://github.com/noryaren/diarflix/blob/main/public/index.php): `public/index.php`
- [SPA shell](https://github.com/noryaren/diarflix/blob/main/app/views/shell.php): `app/views/shell.php`
- [Browser player](https://github.com/noryaren/diarflix/blob/main/public/assets/app.js): `public/assets/app.js`

### Application backend

- [Browse & admin API](https://github.com/noryaren/diarflix/blob/main/app/api.php): `app/api.php`
- [JWT authentication](https://github.com/noryaren/diarflix/blob/main/app/auth.php): `app/auth.php`
- [Application bootstrap](https://github.com/noryaren/diarflix/blob/main/app/bootstrap.php): `app/bootstrap.php`
- [Application helpers](https://github.com/noryaren/diarflix/blob/main/app/helpers.php): `app/helpers.php`

### Media library

- [Library scanner](https://github.com/noryaren/diarflix/blob/main/app/scanner.php): `app/scanner.php`
- [Media & subtitle delivery](https://github.com/noryaren/diarflix/blob/main/app/stream.php): `app/stream.php`
- **Media files**
- **ffmpeg / ffprobe**

### Persistent state

- [Database connection](https://github.com/noryaren/diarflix/blob/main/app/db.php): `app/db.php`
- **MariaDB / MySQL**
- [Poster uploads](https://github.com/noryaren/diarflix/tree/main/storage/covers): `storage/covers`

### Other components

- **Viewer / admin**

## Connections

- Viewer / admin → HTTP front controller: opens player (evidence: `README.md`)
- HTTP front controller → Application bootstrap: loads (evidence: `public/index.php`)
- Application bootstrap → Application helpers: loads (evidence: `app/bootstrap.php`)
- Application bootstrap → Database connection: loads (evidence: `app/bootstrap.php`)
- Application bootstrap → JWT authentication: loads (evidence: `app/bootstrap.php`)
- HTTP front controller → SPA shell: renders (evidence: `public/index.php`)
- SPA shell → Browser player: loads (evidence: `app/views/shell.php`)
- Browser player → Browse & admin API: requests data (evidence: `README.md`)
- HTTP front controller → Browse & admin API: dispatches API (evidence: `public/index.php`)
- Browse & admin API → JWT authentication: checks identity (evidence: `app/api.php`)
- JWT authentication → Database connection: queries users (evidence: `app/auth.php`)
- Browse & admin API → Database connection: reads and writes (evidence: `app/api.php`)
- Database connection → MariaDB / MySQL: connects (evidence: `app/db.php`)
- Browser player → HTTP front controller: requests streams (evidence: `README.md`)
- HTTP front controller → Media & subtitle delivery: routes media (evidence: `public/index.php`)
- Media & subtitle delivery → Media files: serves ranges (evidence: `README.md`)
- Media & subtitle delivery → MariaDB / MySQL: looks up posters (evidence: `app/stream.php`)
- HTTP front controller → Library scanner: loads scanner (evidence: `public/index.php`)
- Browse & admin API → Library scanner: starts web scan
- Viewer / admin → Library scanner: runs CLI scan (evidence: `README.md`)
- Library scanner → Media files: scans files (evidence: `app/scanner.php`)
- Library scanner → MariaDB / MySQL: updates library (evidence: `app/scanner.php`)
- Library scanner → ffmpeg / ffprobe: extracts subtitles (evidence: `app/scanner.php`)
- Browse & admin API → Poster uploads: saves posters (evidence: `README.md`)
