Self-hosted file uploads, signed download URLs, owner-scoped deduplication.
181
Self-hosted file uploads, signed download URLs, owner-scoped deduplication, and TUS resumable uploads — the ingestion layer for the BeTechSpark Media Platform. Built in Rust for production workloads.
@betechspark/fileserver-client, @betechspark/fileserver-server, @betechspark/fileserver-react on npmPair with Image Proxy for end-to-end media: upload here, transform and deliver images there.
POST /files with metadata (owner, visibility, MIME type)POST /sign, ?exp=&sig=)deduped: trueMinimal setup: in-memory metadata and local filesystem storage. No Postgres or S3 required.
docker run -d --name fileserver \
-p 3004:3004 \
-e DATABASE_KIND=inmemory \
-e STORAGE_KIND=fs \
-e FILESERVER_SIGNING_SECRET=change-me-in-production \
-e RUST_LOG=info \
florianbloechinger/fileserver:latest
curl http://localhost:3004/health
curl -X POST http://localhost:3004/files \
-F "file=@./photo.jpg" \
-F "owner_id=alice" \
-F "mime_type=image/jpeg" \
-F "visibility=public"
Example response:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"hash": "blake3:…",
"deduped": false
}
Use the returned id with Image Proxy (fileserver/<id> source keys) or download via GET /files/:id.
services:
fileserver:
image: florianbloechinger/fileserver:latest
ports:
- "3004:3004"
environment:
FILESERVER_PORT: "3004"
DATABASE_KIND: inmemory
STORAGE_KIND: fs
FILESERVER_SIGNING_SECRET: change-me-in-production
RUST_LOG: info
volumes:
- fileserver_data:/app/data
- fileserver_tmp:/app/tmp
volumes:
fileserver_data:
fileserver_tmp:
Full guides (persistence, S3, Kubernetes, SDKs): File Server docs.
| Tag | Description |
|---|---|
latest | Latest successful build from main |
main-<sha> | Specific commit on main (e.g. main-abc1234) |
v1.2.3 / 1.2.3 | Release tags when published |
| Endpoint | Description |
|---|---|
GET /health | Health check |
POST /files | Upload a file (multipart) |
GET /files/:id | Download by logical file ID |
HEAD /files/:id | Metadata / existence check |
DELETE /files/:id | Delete a file (owner-scoped) |
POST /sign | Create a signed download URL |
POST /files/tus | TUS resumable upload (create) |
PATCH /files/tus/:id | TUS upload chunks |
See the API reference for request/response details.
| Variable | Default | Description |
|---|---|---|
FILESERVER_PORT | 3004 | HTTP port |
FILESERVER_HOST | 0.0.0.0 | Bind address |
DATABASE_KIND | — | inmemory, postgres, surrealdb, … |
DATABASE_URL | — | Postgres connection string when using postgres |
STORAGE_KIND | — | fs (local disk) or s3 |
FILESERVER_STORAGE_ROOT | ./data | Blob root for filesystem storage |
FILESERVER_SIGNING_SECRET | (required) | HMAC secret for signed URLs — set a strong value in production |
S3_* | — | S3 endpoint, bucket, credentials when STORAGE_KIND=s3 |
RUST_LOG | — | Log level (e.g. info, debug) |
For the full list, see Reference: env vars.
Typical media stack on one host. Share the blob volume and set FILESERVER_BLOB_SOURCE_PREFIX so Image Proxy reads objects/<hash> from disk (not via S3):
services:
fileserver:
image: florianbloechinger/fileserver:latest
ports:
- "3004:3004"
environment:
DATABASE_KIND: inmemory
STORAGE_KIND: fs
FILESERVER_STORAGE_ROOT: /app/data
FILESERVER_SIGNING_SECRET: change-me-in-production
RUST_LOG: info
volumes:
- media_blobs:/app/data
imageproxy:
image: florianbloechinger/imageproxy:latest
ports:
- "3001:3001"
environment:
DATABASE_URL: memory
IMAGE_SOURCES_ENABLED: filesystem,url,fileserver
FILESERVER_BASE_URL: http://fileserver:3004
FILESERVER_BLOB_SOURCE_PREFIX: fs/data
FS_IMAGE_ROOTS: /app/data
JWT_SECRET: change-me-in-production
RUST_LOG: info
volumes:
- media_blobs:/app/data:ro
depends_on:
- fileserver
volumes:
media_blobs:
After upload, transform via GET /asset/<base64url("fileserver/<uuid>")>?w=800&f=webp on port 3001.
EXP=$(($(date +%s) + 300))
curl -s -X POST http://localhost:3004/sign \
-H "Content-Type: application/json" \
-d "{\"file_id\":\"<uuid>\",\"owner_id\":\"alice\",\"perm\":\"read\",\"exp_unix\":$EXP}"
Flow: app uploads to File Server → Image Proxy transforms via fileserver/<id> or catalog /image/:id when metadata is shared.
More: Media platform integration.
| Component | Role |
|---|---|
| File Server (this image) | Uploads, metadata, signed URLs, TUS |
| Image Proxy | Transform, cache, and deliver images |
| @betechspark npm packages | HTTP client, server middleware, React upload hooks |
BeTechSpark — self-hosted media stack. You own the infrastructure, data, and delivery.
Content type
Image
Digest
sha256:622b25b1b…
Size
34 MB
Last updated
6 months ago
docker pull florianbloechinger/fileserver