2026-04-28 20:35:29 +03:00
# WarpBox
WarpBox is a small, self-hosted file sharing app with temporary upload boxes,
2026-04-30 02:32:45 +03:00
simple download links, optional passwords, ZIP downloads, generated image
thumbnails, and a very deliberate retro desktop mood.
2026-04-28 20:35:29 +03:00
It is meant to feel quick: pick files, choose how long the box should live,
upload, and share the link.
```mermaid
flowchart LR
2026-04-30 02:32:45 +03:00
User[Person in browser]
UI[WarpBox UI]
API[Go HTTP server]
Manifest[(Box manifest JSON)]
Files[(Uploaded files)]
Thumbs[(Thumbnail JPEGs)]
DB[(BadgerDB metadata)]
User --> UI
UI -->|create box / upload / poll status| API
API --> Manifest
API --> Files
API --> DB
Files -->|download files or build ZIP| API
Thumbs -->|preview URLs| UI
Files -->|scan image files| Thumbs
2026-04-28 20:35:29 +03:00
```
## Features
- Multi-file uploads through a browser UI.
- Temporary boxes with configurable retention choices.
- Optional password protection per box.
- Individual file downloads or a single ZIP download.
- One-time download mode for ZIP-only handoff.
- Background thumbnails for image files.
- Plain filesystem storage, with JSON manifests next to uploaded files.
2026-04-30 02:32:45 +03:00
- Local BadgerDB metadata store for users, tags, sessions, and settings.
- No external database service required.
2026-04-28 20:35:29 +03:00
## How It Fits Together
```mermaid
flowchart TB
Browser[Browser UI]
Server[Go HTTP server]
Manifest[Box manifest JSON]
Files[Uploaded files]
Thumbs[Generated thumbnails]
2026-04-30 02:32:45 +03:00
DB[(BadgerDB metadata)]
2026-04-28 20:35:29 +03:00
2026-04-30 02:32:45 +03:00
Browser -->|POST /box, uploads, status polls| Server
2026-04-28 20:35:29 +03:00
Server --> Manifest
Server --> Files
Server --> Thumbs
2026-04-30 02:32:45 +03:00
Server --> DB
2026-04-28 20:35:29 +03:00
Thumbs -->|preview URLs| Browser
Files -->|downloads / ZIP| Browser
```
## Quick Start
Requirements:
- Go 1.22 or newer.
Run the app:
```bash
go run ./cmd run
```
Then open:
```text
http://localhost:8080
```
To listen somewhere else:
```bash
go run ./cmd run --addr :3000
```
## Configuration
2026-04-28 21:11:37 +03:00
WarpBox loads defaults, applies environment variables at startup, then applies
2026-05-01 02:14:05 +03:00
safe admin settings overrides from BadgerDB. Storage path settings remain
environment controlled.
2026-04-28 21:11:37 +03:00
| Variable | Default | What it does |
| --- | ---: | --- |
| `WARPBOX_DATA_DIR` | `./data` | Root directory for uploads and metadata. |
| `WARPBOX_ADMIN_PASSWORD` | empty | Bootstraps the first admin when set. |
| `WARPBOX_ADMIN_USERNAME` | `admin` | Bootstrap admin username. |
| `WARPBOX_ADMIN_EMAIL` | empty | Bootstrap admin email. |
| `WARPBOX_ADMIN_ENABLED` | `auto` | Admin login mode: `auto` , `true` , or `false` . |
| `WARPBOX_ALLOW_ADMIN_SETTINGS_OVERRIDE` | `true` | Allows safe settings overrides from `/admin/settings` . |
| `WARPBOX_ADMIN_COOKIE_SECURE` | `false` | Sets the Secure flag on admin session cookies. |
| `WARPBOX_GUEST_UPLOADS_ENABLED` | `true` | Enables guest uploads. |
| `WARPBOX_API_ENABLED` | `true` | Enables JSON/upload endpoints used by the UI. |
| `WARPBOX_ZIP_DOWNLOADS_ENABLED` | `true` | Enables ZIP downloads. |
| `WARPBOX_ONE_TIME_DOWNLOADS_ENABLED` | `true` | Enables one-time download boxes. |
2026-04-30 04:24:49 +03:00
| `WARPBOX_ONE_TIME_DOWNLOAD_EXPIRY_SECONDS` | `604800` | One-time box lifetime after uploads finish; `0` disables timed expiry. |
| `WARPBOX_ONE_TIME_DOWNLOAD_RETRY_ON_FAILURE` | `false` | Keeps one-time boxes alive when ZIP build/send fails before completion. |
2026-04-28 21:11:37 +03:00
| `WARPBOX_RENEW_ON_ACCESS_ENABLED` | `false` | Renews expiring boxes on access. |
| `WARPBOX_RENEW_ON_DOWNLOAD_ENABLED` | `false` | Renews expiring boxes on download. |
| `WARPBOX_DEFAULT_GUEST_EXPIRY_SECONDS` | `10` | Default guest retention. |
| `WARPBOX_MAX_GUEST_EXPIRY_SECONDS` | `172800` | Max guest retention shown/accepted. |
2026-05-01 02:14:05 +03:00
| `WARPBOX_GLOBAL_MAX_FILE_SIZE_GB` | `0` | Per-file cap in GB using `1024^3` conversion; `0` means unlimited. Decimals allowed, like `0.5` . |
| `WARPBOX_GLOBAL_MAX_BOX_SIZE_GB` | `0` | Per-box cap in GB using `1024^3` conversion; `0` means unlimited. Decimals allowed. |
| `WARPBOX_DEFAULT_USER_MAX_FILE_SIZE_GB` | `0` | Default user file cap in GB using `1024^3` conversion. |
| `WARPBOX_DEFAULT_USER_MAX_BOX_SIZE_GB` | `0` | Default user box cap in GB using `1024^3` conversion. |
2026-04-28 21:11:37 +03:00
| `WARPBOX_SESSION_TTL_SECONDS` | `86400` | Admin session lifetime. |
| `WARPBOX_BOX_POLL_INTERVAL_MS` | `5000` | Browser polling interval for box/file status updates. |
| `WARPBOX_THUMBNAIL_BATCH_SIZE` | `10` | Number of pending thumbnails processed per worker pass. |
| `WARPBOX_THUMBNAIL_INTERVAL_SECONDS` | `30` | Delay between thumbnail worker passes. |
2026-04-28 20:35:29 +03:00
2026-05-01 02:14:05 +03:00
Legacy `_MB` and `_BYTES` size env names are still accepted for compatibility, but GB env names are the intended format now. GB input uses `1024^3` bytes so UI limits and displayed space stay consistent.
2026-04-30 02:32:45 +03:00
2026-04-28 20:35:29 +03:00
Example:
```bash
2026-04-28 21:11:37 +03:00
WARPBOX_ADMIN_PASSWORD='change-me' \
2026-04-30 04:24:49 +03:00
WARPBOX_ONE_TIME_DOWNLOAD_EXPIRY_SECONDS=604800 \
2026-04-28 20:35:29 +03:00
WARPBOX_BOX_POLL_INTERVAL_MS=2000 \
WARPBOX_THUMBNAIL_BATCH_SIZE=20 \
WARPBOX_THUMBNAIL_INTERVAL_SECONDS=10 \
go run ./cmd run --addr :8080
```
2026-04-28 21:11:37 +03:00
Open `/admin/login` after startup to sign in with the bootstrap admin.
2026-04-28 20:35:29 +03:00
## Storage
Uploads are stored locally under:
```text
2026-04-28 21:11:37 +03:00
<WARPBOX_DATA_DIR>/uploads/
2026-04-28 20:35:29 +03:00
```
Each box gets its own directory containing the uploaded files and a
`.warpbox.json` manifest. Image thumbnails are stored inside a box-local
`.thumbnails` directory.
2026-04-28 21:11:37 +03:00
Persistent app metadata lives in BadgerDB under:
```text
<WARPBOX_DATA_DIR>/db/
```
2026-04-28 20:35:29 +03:00
```text
data/uploads/
+-- <box-id>/
+-- .warpbox.json
+-- file.txt
+-- .thumbnails/
+-- <file-id>.jpg
2026-04-28 21:11:37 +03:00
data/db/
2026-04-28 20:35:29 +03:00
```
## Project Layout
```text
2026-04-30 02:32:45 +03:00
cmd/ CLI entrypoint
lib/server/ HTTP handlers and server setup
lib/routing/ Route registration
lib/boxstore/ Box storage, manifests, downloads, thumbnails
lib/config/ Typed environment and runtime settings config
lib/metastore/ BadgerDB metadata store for users, tags, settings, sessions
lib/helpers/ Small shared helpers
lib/models/ Shared request/response models
templates/ Server-rendered HTML
static/css/ Stylesheets
static/js/ Browser scripts
static/img/ Icons, sprites, and backgrounds
static/fonts/ Bitmap/pixel fonts
static/cursors/ Custom cursor packs
static/popups/ HTML popup content
docs/ Project documentation
2026-04-28 20:35:29 +03:00
```
## Notes
2026-04-30 02:32:45 +03:00
WarpBox is intentionally simple. It uses the local filesystem for box data,
BadgerDB for app metadata, relies on generated box IDs for share links, and
keeps most behavior easy to follow from the Go handlers and the small browser
scripts.
2026-04-28 20:35:29 +03:00
For a short implementation overview, see [docs/tech.md ](docs/tech.md ).