# rumjer/rfiledrive architecture

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

- Interactive diagram: https://gitdiagram.com/rumjer/rfiledrive
- Repository: https://github.com/rumjer/rfiledrive

## Overview

rFiledrive is a self-hosted browser file manager and editor. A user opens the web interface, browses and manages files through server routes, and can preview or edit supported files; edits may create recoverable versions. The graph preserves the documented trash, storage, and SQLite-editing capabilities. Source excerpts show route registration and several backend calls, but not all route implementations or the full main-page wiring, so some documented browser/API relationships are dashed.

Main entry points: [`main.cpp`](https://github.com/rumjer/rfiledrive/blob/main/main.cpp) (HTTP server and routes), [`mainfunctions.cpp`](https://github.com/rumjer/rfiledrive/blob/main/mainfunctions.cpp) (File operations), [`index.html`](https://github.com/rumjer/rfiledrive/blob/main/index.html) (File manager UI), [`liveedit.js`](https://github.com/rumjer/rfiledrive/blob/main/liveedit.js) (Viewer and editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser experience"]
  node_webui["File manager UI<br/>[index.html]"]
  node_editor["Viewer and editor<br/>[liveedit.js]"]
end

subgraph group_routes["HTTP application"]
  node_server["HTTP server and routes<br/>[main.cpp]"]
end

subgraph group_files["File operations"]
  node_fileops["File operations<br/>[mainfunctions.cpp]"]
  node_filedata["Managed files"]
  node_trash["Trash and restore<br/>[mainfunctions.cpp]"]
  node_storage["Storage insights<br/>[mainfunctions.cpp]"]
  node_heic["HEIC previews<br/>[mainfunctions.cpp]"]
end

subgraph group_editing["Editing and recovery"]
  node_safeedit["Safe saves and versions<br/>[liveedit.cpp]"]
  node_sqlite["SQLite viewer and editor<br/>[sqlite_db.cpp]"]
  node_sqlitefiles[("SQLite files")]
end

subgraph group_runtime["Runtime libraries"]
  node_httplib["HTTP library<br/>[httplib.h]"]
  node_json["JSON library<br/>[json.hpp]"]
  node_imagewriter["Image writer library<br/>[stb_image_write.h]"]
end

node_user(("Browser user"))

node_user -->|"uses"| node_webui
node_webui -.->|"requests APIs"| node_server
node_webui -->|"opens editor"| node_editor
node_editor -->|"requests file info"| node_server
node_editor -->|"requests SQLite schema"| node_server
node_server -->|"registers routes"| node_httplib
node_server -->|"calls file operations"| node_fileops
node_server -->|"calls trash actions"| node_trash
node_server -->|"requests storage info"| node_storage
node_server -->|"registers edit routes"| node_safeedit
node_server -->|"registers database routes"| node_sqlite
node_fileops -->|"manages files"| node_filedata
node_trash -->|"moves and restores"| node_filedata
node_storage -->|"measures usage"| node_filedata
node_heic -->|"converts previews"| node_filedata
node_fileops -->|"includes"| node_imagewriter
node_safeedit -->|"saves and versions"| node_filedata
node_sqlite -->|"reads and edits"| node_sqlitefiles
node_sqlite -->|"backs up edits"| node_safeedit
node_fileops -->|"uses JSON"| node_json

click node_webui "https://github.com/rumjer/rfiledrive/blob/main/index.html"
click node_editor "https://github.com/rumjer/rfiledrive/blob/main/liveedit.js"
click node_server "https://github.com/rumjer/rfiledrive/blob/main/main.cpp"
click node_fileops "https://github.com/rumjer/rfiledrive/blob/main/mainfunctions.cpp"
click node_trash "https://github.com/rumjer/rfiledrive/blob/main/mainfunctions.cpp"
click node_storage "https://github.com/rumjer/rfiledrive/blob/main/mainfunctions.cpp"
click node_heic "https://github.com/rumjer/rfiledrive/blob/main/mainfunctions.cpp"
click node_safeedit "https://github.com/rumjer/rfiledrive/blob/main/liveedit.cpp"
click node_sqlite "https://github.com/rumjer/rfiledrive/blob/main/sqlite_db.cpp"
click node_httplib "https://github.com/rumjer/rfiledrive/blob/main/httplib.h"
click node_json "https://github.com/rumjer/rfiledrive/blob/main/json.hpp"
click node_imagewriter "https://github.com/rumjer/rfiledrive/blob/main/stb_image_write.h"

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_webui,node_editor,node_user toneBlue
class node_server toneAmber
class node_fileops,node_filedata,node_trash,node_storage,node_heic toneMint
class node_safeedit,node_sqlite,node_sqlitefiles toneRose
class node_httplib,node_json,node_imagewriter toneIndigo
```

## Components

### Browser experience

- [File manager UI](https://github.com/rumjer/rfiledrive/blob/main/index.html): `index.html`
- [Viewer and editor](https://github.com/rumjer/rfiledrive/blob/main/liveedit.js): `liveedit.js`

### HTTP application

- [HTTP server and routes](https://github.com/rumjer/rfiledrive/blob/main/main.cpp): `main.cpp`

### File operations

- [File operations](https://github.com/rumjer/rfiledrive/blob/main/mainfunctions.cpp): `mainfunctions.cpp`
- **Managed files**
- [Trash and restore](https://github.com/rumjer/rfiledrive/blob/main/mainfunctions.cpp): `mainfunctions.cpp`
- [Storage insights](https://github.com/rumjer/rfiledrive/blob/main/mainfunctions.cpp): `mainfunctions.cpp`
- [HEIC previews](https://github.com/rumjer/rfiledrive/blob/main/mainfunctions.cpp): `mainfunctions.cpp`

### Editing and recovery

- [Safe saves and versions](https://github.com/rumjer/rfiledrive/blob/main/liveedit.cpp): `liveedit.cpp`
- [SQLite viewer and editor](https://github.com/rumjer/rfiledrive/blob/main/sqlite_db.cpp): `sqlite_db.cpp`
- **SQLite files**

### Runtime libraries

- [HTTP library](https://github.com/rumjer/rfiledrive/blob/main/httplib.h): `httplib.h`
- [JSON library](https://github.com/rumjer/rfiledrive/blob/main/json.hpp): `json.hpp`
- [Image writer library](https://github.com/rumjer/rfiledrive/blob/main/stb_image_write.h): `stb_image_write.h`

### Other components

- **Browser user**

## Connections

- Browser user → File manager UI: uses (evidence: `README.md`)
- File manager UI → HTTP server and routes: requests APIs
- File manager UI → Viewer and editor: opens editor (evidence: `liveedit.js`)
- Viewer and editor → HTTP server and routes: requests file info (evidence: `liveedit.js`)
- Viewer and editor → HTTP server and routes: requests SQLite schema (evidence: `liveedit.js`)
- HTTP server and routes → HTTP library: registers routes (evidence: `main.cpp`)
- HTTP server and routes → File operations: calls file operations (evidence: `main.cpp`)
- HTTP server and routes → Trash and restore: calls trash actions (evidence: `main.cpp`)
- HTTP server and routes → Storage insights: requests storage info (evidence: `main.cpp`)
- HTTP server and routes → Safe saves and versions: registers edit routes (evidence: `main.cpp`)
- HTTP server and routes → SQLite viewer and editor: registers database routes (evidence: `main.cpp`)
- File operations → Managed files: manages files (evidence: `README.md`)
- Trash and restore → Managed files: moves and restores
- Storage insights → Managed files: measures usage (evidence: `README.md`)
- HEIC previews → Managed files: converts previews (evidence: `README.md`)
- File operations → Image writer library: includes (evidence: `mainfunctions.cpp`)
- Safe saves and versions → Managed files: saves and versions (evidence: `liveedit.cpp`)
- SQLite viewer and editor → SQLite files: reads and edits (evidence: `sqlite_db.cpp`)
- SQLite viewer and editor → Safe saves and versions: backs up edits (evidence: `sqlite_db.cpp`)
- File operations → JSON library: uses JSON
