42 lines
1.6 KiB
Markdown
42 lines
1.6 KiB
Markdown
|
|
# Warpbox.dev
|
||
|
|
|
||
|
|
This repository contains the Go backend base for `warpbox.dev`, a self-hosted transfer-first file sharing application.
|
||
|
|
|
||
|
|
## Run
|
||
|
|
|
||
|
|
```bash
|
||
|
|
./scripts/run/dev.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
The default server listens on `:8080`.
|
||
|
|
|
||
|
|
Upload size limits are configured in megabytes through `WARPBOX_MAX_UPLOAD_SIZE_MB`.
|
||
|
|
Fractions are supported, so `0.5Mb` is 512 KiB and `1.5Mb` is 1536 KiB.
|
||
|
|
|
||
|
|
For one-off Go commands, run them from the backend module:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd backend
|
||
|
|
go run ./cmd/warpbox
|
||
|
|
```
|
||
|
|
|
||
|
|
## Layout
|
||
|
|
|
||
|
|
- `backend/cmd/warpbox` - main application entry point.
|
||
|
|
- `backend/libs/config` - environment-backed configuration.
|
||
|
|
- `backend/libs/httpserver` - server construction and route composition.
|
||
|
|
- `backend/libs/handlers` - HTTP handlers for pages, API, health, static files.
|
||
|
|
- `backend/libs/middleware` - request logging, recovery, security headers, gzip, request IDs.
|
||
|
|
- `backend/libs/services` - business logic boundaries, starting with upload limits.
|
||
|
|
- `backend/libs/helpers` - small reusable helpers.
|
||
|
|
- `backend/libs/web` - Go template renderer.
|
||
|
|
- `backend/templates` - server-rendered Go templates.
|
||
|
|
- `backend/static/css`, `backend/static/js`, `backend/static/img`, `backend/static/fonts` - public assets served from `/static/`.
|
||
|
|
- `scripts/run/dev.sh` - local development runner.
|
||
|
|
- `scripts/env/dev.env.example` - tracked development environment template.
|
||
|
|
- `scripts/env/dev.env` - local development environment, ignored by git.
|
||
|
|
|
||
|
|
## Static Asset Policy
|
||
|
|
|
||
|
|
The static handler sets long-lived immutable caching for images, video, audio, and fonts, shorter caching for CSS/JS, and gzip compression for compressible responses. Upload storage is intentionally only a placeholder at this stage.
|