# paridhijhabak/sourcebox architecture

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

- Interactive diagram: https://gitdiagram.com/paridhijhabak/sourcebox
- Repository: https://github.com/paridhijhabak/sourcebox

## Overview

SourceBox is a self-hosted file vault. Users register, clone, or create projects; SourceBox indexes their files, then supports browsing, plain-language search, previews, colour extraction, and file history. Users can also manage accounts, stars, themes, and folder shares. Background watchers and git polling keep projects current. The graph follows documented product capabilities and visible module references; some server routes and UI-to-API wiring were not sampled, so those links are omitted where their ownership cannot be established.

Main entry points: [`server.js`](https://github.com/paridhijhabak/sourcebox/blob/main/server.js) (HTTP API), [`lib/sync.js`](https://github.com/paridhijhabak/sourcebox/blob/main/lib/sync.js) (Folder and git sync), [`lib/indexer.js`](https://github.com/paridhijhabak/sourcebox/blob/main/lib/indexer.js) (File indexer), [`lib/git.js`](https://github.com/paridhijhabak/sourcebox/blob/main/lib/git.js) (Git operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_project["Projects and indexing"]
  node_config[("Vault configuration<br/>[config.js]")]
  node_projects["Project management<br/>[server.js]"]
  node_indexer["File indexer<br/>[indexer.js]"]
end

subgraph group_sync["Sync and git"]
  node_sync["Folder and git sync<br/>[sync.js]"]
  node_git["Git operations<br/>[git.js]"]
end

subgraph group_discovery["Find and preview"]
  node_search["Plain-language search<br/>[search.js]"]
  node_fileaccess["File browsing and history<br/>[server.js]"]
  node_thumbnails["Thumbnail generation<br/>[thumbs.js]"]
  node_palette["Image colours<br/>[palette.js]"]
end

subgraph group_vault["Access and sharing"]
  node_users[("Local accounts<br/>[users.js]")]
  node_auth["Authentication<br/>[auth.js]"]
  node_shares[("Folder shares<br/>[shares.js]")]
  node_stars[("Starred files<br/>[stars.js]")]
  node_theme["Vault theme<br/>[theme.js]"]
end

subgraph group_app["Vault interface"]
  node_ui["Vault interface<br/>[app.js]"]
  node_searchui["Search interface<br/>[search.js]"]
  node_server["HTTP API<br/>[server.js]"]
end

node_user(("Vault user"))
node_filesystem[("Project folders")]
node_remote["Git remote"]

node_user -->|"uses"| node_ui
node_ui -.->|"requests"| node_server
node_searchui -.->|"searches"| node_server
node_server -->|"reads settings"| node_config
node_server -->|"rebuilds index"| node_indexer
node_indexer -->|"scans files"| node_filesystem
node_server -->|"manages sync"| node_sync
node_sync -->|"re-indexes"| node_indexer
node_sync -->|"polls and pulls"| node_git
node_git -->|"fetches commits"| node_remote
node_server -.->|"serves search"| node_search
node_server -->|"serves files"| node_fileaccess
node_server -.->|"requests thumbnails"| node_thumbnails
node_server -.->|"extracts colours"| node_palette
node_server -->|"applies access control"| node_auth
node_auth -->|"checks accounts"| node_users
node_server -->|"manages links"| node_shares
node_server -->|"manages stars"| node_stars
node_server -.->|"manages settings"| node_theme

click node_ui "https://github.com/paridhijhabak/sourcebox/blob/main/public/app.js"
click node_searchui "https://github.com/paridhijhabak/sourcebox/blob/main/public/search.js"
click node_server "https://github.com/paridhijhabak/sourcebox/blob/main/server.js"
click node_config "https://github.com/paridhijhabak/sourcebox/blob/main/lib/config.js"
click node_projects "https://github.com/paridhijhabak/sourcebox/blob/main/server.js"
click node_indexer "https://github.com/paridhijhabak/sourcebox/blob/main/lib/indexer.js"
click node_sync "https://github.com/paridhijhabak/sourcebox/blob/main/lib/sync.js"
click node_git "https://github.com/paridhijhabak/sourcebox/blob/main/lib/git.js"
click node_search "https://github.com/paridhijhabak/sourcebox/blob/main/public/search.js"
click node_fileaccess "https://github.com/paridhijhabak/sourcebox/blob/main/server.js"
click node_thumbnails "https://github.com/paridhijhabak/sourcebox/blob/main/lib/thumbs.js"
click node_palette "https://github.com/paridhijhabak/sourcebox/blob/main/lib/palette.js"
click node_users "https://github.com/paridhijhabak/sourcebox/blob/main/lib/users.js"
click node_auth "https://github.com/paridhijhabak/sourcebox/blob/main/lib/auth.js"
click node_shares "https://github.com/paridhijhabak/sourcebox/blob/main/lib/shares.js"
click node_stars "https://github.com/paridhijhabak/sourcebox/blob/main/lib/stars.js"
click node_theme "https://github.com/paridhijhabak/sourcebox/blob/main/lib/theme.js"

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_config,node_projects,node_indexer,node_user toneBlue
class node_sync,node_git,node_filesystem toneAmber
class node_search,node_fileaccess,node_thumbnails,node_palette toneMint
class node_users,node_auth,node_shares,node_stars,node_theme toneRose
class node_ui,node_searchui,node_server,node_remote toneIndigo
```

## Components

### Projects and indexing

- [Vault configuration](https://github.com/paridhijhabak/sourcebox/blob/main/lib/config.js): `lib/config.js`
- [Project management](https://github.com/paridhijhabak/sourcebox/blob/main/server.js): `server.js`
- [File indexer](https://github.com/paridhijhabak/sourcebox/blob/main/lib/indexer.js): `lib/indexer.js`

### Sync and git

- [Folder and git sync](https://github.com/paridhijhabak/sourcebox/blob/main/lib/sync.js): `lib/sync.js`
- [Git operations](https://github.com/paridhijhabak/sourcebox/blob/main/lib/git.js): `lib/git.js`

### Find and preview

- [Plain-language search](https://github.com/paridhijhabak/sourcebox/blob/main/public/search.js): `public/search.js`
- [File browsing and history](https://github.com/paridhijhabak/sourcebox/blob/main/server.js): `server.js`
- [Thumbnail generation](https://github.com/paridhijhabak/sourcebox/blob/main/lib/thumbs.js): `lib/thumbs.js`
- [Image colours](https://github.com/paridhijhabak/sourcebox/blob/main/lib/palette.js): `lib/palette.js`

### Access and sharing

- [Local accounts](https://github.com/paridhijhabak/sourcebox/blob/main/lib/users.js): `lib/users.js`
- [Authentication](https://github.com/paridhijhabak/sourcebox/blob/main/lib/auth.js): `lib/auth.js`
- [Folder shares](https://github.com/paridhijhabak/sourcebox/blob/main/lib/shares.js): `lib/shares.js`
- [Starred files](https://github.com/paridhijhabak/sourcebox/blob/main/lib/stars.js): `lib/stars.js`
- [Vault theme](https://github.com/paridhijhabak/sourcebox/blob/main/lib/theme.js): `lib/theme.js`

### Vault interface

- [Vault interface](https://github.com/paridhijhabak/sourcebox/blob/main/public/app.js): `public/app.js`
- [Search interface](https://github.com/paridhijhabak/sourcebox/blob/main/public/search.js): `public/search.js`
- [HTTP API](https://github.com/paridhijhabak/sourcebox/blob/main/server.js): `server.js`

### Other components

- **Vault user**
- **Project folders**
- **Git remote**

## Connections

- Vault user → Vault interface: uses (evidence: `README.md`)
- Vault interface → HTTP API: requests
- Search interface → HTTP API: searches
- HTTP API → Vault configuration: reads settings (evidence: `server.js`)
- HTTP API → File indexer: rebuilds index (evidence: `server.js`)
- File indexer → Project folders: scans files (evidence: `lib/indexer.js`)
- HTTP API → Folder and git sync: manages sync (evidence: `README.md`)
- Folder and git sync → File indexer: re-indexes (evidence: `lib/sync.js`)
- Folder and git sync → Git operations: polls and pulls (evidence: `lib/sync.js`)
- Git operations → Git remote: fetches commits (evidence: `README.md`)
- HTTP API → Plain-language search: serves search
- HTTP API → File browsing and history: serves files (evidence: `server.js`)
- HTTP API → Thumbnail generation: requests thumbnails (evidence: `server.js`)
- HTTP API → Image colours: extracts colours (evidence: `server.js`)
- HTTP API → Authentication: applies access control (evidence: `server.js`)
- Authentication → Local accounts: checks accounts (evidence: `lib/auth.js`)
- HTTP API → Folder shares: manages links (evidence: `server.js`)
- HTTP API → Starred files: manages stars (evidence: `server.js`)
- HTTP API → Vault theme: manages settings (evidence: `server.js`)
