# 0xjeanpierre/nulldrive architecture

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

- Interactive diagram: https://gitdiagram.com/0xjeanpierre/nulldrive
- Repository: https://github.com/0xjeanpierre/nulldrive

## Overview

nulldrive is a Pastebin-style text and file-sharing service. Users create text pastes or upload resumable chunks, then share pages and download content with integrity hashes; file downloads support HTTP Range. The graph separates browser interaction, API/domain handling, persistence and retention, and configuration/documentation. Several frontend-to-API details and admin/docs internals are unsampled, so only documented or indexed relationships are shown.

Main entry points: [`app/src/server.js`](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/server.js) (HTTP application), [`app/src/routes/uploads.js`](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/uploads.js) (Upload and downloads), [`app/src/routes/pastes.js`](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/pastes.js) (Paste handling), [`app/src/services/cleanup.js`](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/services/cleanup.js) (Expiry cleanup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser experience"]
  node_home["Home interface<br/>[index.html]"]
  node_home_logic["Home interactions<br/>[app.js]"]
  node_shared_ui["Shared UI utilities<br/>[common.js]"]
  node_chunk_client["Chunk uploader<br/>[uploader.js]"]
  node_paste_page["Paste viewer<br/>[paste.js]"]
  node_file_page["File viewer<br/>[file.js]"]
end

subgraph group_api["Content API"]
  node_server["HTTP application<br/>[server.js]"]
  node_paste_api["Paste handling<br/>[pastes.js]"]
  node_upload_api["Upload and downloads<br/>[uploads.js]"]
  node_validation["Input validation<br/>[validate.js]"]
  node_http_errors["HTTP helpers<br/>[http.js]"]
  node_hashing["IDs and MD5<br/>[hash.js]"]
end

subgraph group_platform["Persistence and retention"]
  node_sqlite[("Metadata database<br/>[db.js]")]
  node_stored_content[("Content files")]
  node_cleanup["Expiry cleanup<br/>[cleanup.js]"]
end

subgraph group_operations["Configuration and docs"]
  node_configuration["Runtime configuration<br/>[config.js]"]
  node_admin_api["Admin controls<br/>[admin.js]"]
  node_api_docs["OpenAPI docs<br/>[docs.js]"]
  node_docs_page["Docs interface<br/>[docs.html]"]
end

node_visitor(("Visitor"))

node_visitor -->|"uses"| node_home
node_home -->|"loads"| node_home_logic
node_home_logic -->|"imports"| node_shared_ui
node_home_logic -->|"uses"| node_chunk_client
node_chunk_client -->|"requests uploads"| node_upload_api
node_paste_page -->|"imports"| node_shared_ui
node_file_page -->|"imports"| node_shared_ui
node_server -->|"mounts"| node_paste_api
node_server -->|"mounts"| node_upload_api
node_server -->|"mounts"| node_admin_api
node_server -->|"mounts"| node_api_docs
node_server -->|"starts"| node_cleanup
node_paste_api -->|"queries"| node_sqlite
node_paste_api -->|"reads and writes"| node_stored_content
node_paste_api -->|"computes hashes"| node_hashing
node_paste_api -->|"sanitizes names"| node_validation
node_paste_api -->|"uses errors"| node_http_errors
node_upload_api -->|"queries"| node_sqlite
node_upload_api -->|"streams files"| node_stored_content
node_upload_api -->|"computes MD5"| node_hashing
node_upload_api -->|"validates names"| node_validation
node_upload_api -->|"uses errors"| node_http_errors
node_cleanup -->|"removes metadata"| node_sqlite
node_cleanup -->|"removes expired files"| node_stored_content
node_cleanup -->|"reacts to changes"| node_configuration
node_admin_api -->|"updates settings"| node_configuration
node_admin_api -->|"triggers cleanup"| node_cleanup
node_admin_api -->|"reads statistics"| node_sqlite
node_server -->|"loads settings"| node_configuration
node_visitor -->|"opens docs"| node_docs_page
node_server -->|"serves static page"| node_docs_page
node_api_docs -->|"documents settings"| node_configuration

click node_home "https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/index.html"
click node_home_logic "https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/app.js"
click node_shared_ui "https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/common.js"
click node_chunk_client "https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/uploader.js"
click node_paste_page "https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/paste.js"
click node_file_page "https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/file.js"
click node_server "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/server.js"
click node_paste_api "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/pastes.js"
click node_upload_api "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/uploads.js"
click node_validation "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/services/validate.js"
click node_http_errors "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/utils/http.js"
click node_hashing "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/utils/hash.js"
click node_sqlite "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/db.js"
click node_cleanup "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/services/cleanup.js"
click node_configuration "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/config.js"
click node_admin_api "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/admin.js"
click node_api_docs "https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/docs.js"
click node_docs_page "https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/docs.html"

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_home,node_home_logic,node_shared_ui,node_chunk_client,node_paste_page,node_file_page toneBlue
class node_server,node_paste_api,node_upload_api,node_validation,node_http_errors,node_hashing toneAmber
class node_sqlite,node_stored_content,node_cleanup toneMint
class node_configuration,node_admin_api,node_api_docs,node_docs_page toneRose
class node_visitor toneIndigo
```

## Components

### Browser experience

- [Home interface](https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/index.html): `app/public/index.html`
- [Home interactions](https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/app.js): `app/public/js/app.js`
- [Shared UI utilities](https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/common.js): `app/public/js/common.js`
- [Chunk uploader](https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/uploader.js): `app/public/js/uploader.js`
- [Paste viewer](https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/paste.js): `app/public/js/paste.js`
- [File viewer](https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/js/file.js): `app/public/js/file.js`

### Content API

- [HTTP application](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/server.js): `app/src/server.js`
- [Paste handling](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/pastes.js): `app/src/routes/pastes.js`
- [Upload and downloads](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/uploads.js): `app/src/routes/uploads.js`
- [Input validation](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/services/validate.js): `app/src/services/validate.js`
- [HTTP helpers](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/utils/http.js): `app/src/utils/http.js`
- [IDs and MD5](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/utils/hash.js): `app/src/utils/hash.js`

### Persistence and retention

- [Metadata database](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/db.js): `app/src/db.js`
- **Content files**
- [Expiry cleanup](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/services/cleanup.js): `app/src/services/cleanup.js`

### Configuration and docs

- [Runtime configuration](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/config.js): `app/src/config.js`
- [Admin controls](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/admin.js): `app/src/routes/admin.js`
- [OpenAPI docs](https://github.com/0xjeanpierre/nulldrive/blob/main/app/src/routes/docs.js): `app/src/routes/docs.js`
- [Docs interface](https://github.com/0xjeanpierre/nulldrive/blob/main/app/public/docs.html): `app/public/docs.html`

### Other components

- **Visitor**

## Connections

- Visitor → Home interface: uses (evidence: `README.md`)
- Home interface → Home interactions: loads
- Home interactions → Shared UI utilities: imports (evidence: `app/public/js/app.js`)
- Home interactions → Chunk uploader: uses (evidence: `app/public/js/app.js`)
- Chunk uploader → Upload and downloads: requests uploads (evidence: `app/public/js/uploader.js`)
- Paste viewer → Shared UI utilities: imports (evidence: `app/public/js/paste.js`)
- File viewer → Shared UI utilities: imports (evidence: `app/public/js/file.js`)
- HTTP application → Paste handling: mounts (evidence: `app/src/server.js`)
- HTTP application → Upload and downloads: mounts (evidence: `app/src/server.js`)
- HTTP application → Admin controls: mounts (evidence: `app/src/server.js`)
- HTTP application → OpenAPI docs: mounts (evidence: `app/src/server.js`)
- HTTP application → Expiry cleanup: starts (evidence: `app/src/server.js`)
- Paste handling → Metadata database: queries (evidence: `app/src/routes/pastes.js`)
- Paste handling → Content files: reads and writes (evidence: `app/src/routes/pastes.js`)
- Paste handling → IDs and MD5: computes hashes (evidence: `app/src/routes/pastes.js`)
- Paste handling → Input validation: sanitizes names (evidence: `app/src/routes/pastes.js`)
- Paste handling → HTTP helpers: uses errors (evidence: `app/src/routes/pastes.js`)
- Upload and downloads → Metadata database: queries (evidence: `app/src/routes/uploads.js`)
- Upload and downloads → Content files: streams files (evidence: `app/src/routes/uploads.js`)
- Upload and downloads → IDs and MD5: computes MD5 (evidence: `app/src/routes/uploads.js`)
- Upload and downloads → Input validation: validates names (evidence: `app/src/routes/uploads.js`)
- Upload and downloads → HTTP helpers: uses errors (evidence: `app/src/routes/uploads.js`)
- Expiry cleanup → Metadata database: removes metadata (evidence: `app/src/services/cleanup.js`)
- Expiry cleanup → Content files: removes expired files (evidence: `app/src/services/cleanup.js`)
- Expiry cleanup → Runtime configuration: reacts to changes (evidence: `app/src/services/cleanup.js`)
- Admin controls → Runtime configuration: updates settings (evidence: `app/src/routes/admin.js`)
- Admin controls → Expiry cleanup: triggers cleanup (evidence: `app/src/routes/admin.js`)
- Admin controls → Metadata database: reads statistics (evidence: `app/src/routes/admin.js`)
- HTTP application → Runtime configuration: loads settings (evidence: `app/src/server.js`)
- Visitor → Docs interface: opens docs (evidence: `README.md`)
- HTTP application → Docs interface: serves static page (evidence: `app/src/server.js`)
- OpenAPI docs → Runtime configuration: documents settings (evidence: `app/src/routes/docs.js`)
