Minimal file upload microservice with S3/MinIO-compatible storage and SQL metadata.
2.8K
Minimal file upload microservice with S3/MinIO-compatible storage and SQL metadata.
POST /v1/files/:file_id/downloadexpires_at multipart field (RFC3339)StorageProviderfiles table (Postgres in production, SQLite fallback for local/dev)POST /v1/files multipart upload with file and optional password / expires_at form fieldsGET /v1/files/:file_id/download returns 302 for files without a passwordPOST /v1/files/:file_id/download accepts a body password and returns 302 for protected filesGET /healthzEnvironment variables (defaults shown):
PORT=8080
DB_PATH=./uploader.db
DATABASE_URL=
MAX_UPLOAD_MB=50
LOG_LEVEL=info
S3_ENDPOINT=minio:9000
S3_ACCESS_KEY=minioadmin
S3_SECRET_KEY=minioadmin
S3_BUCKET=uploads
S3_REGION=
S3_USE_SSL=false
# Comma-separated list of allowed CORS origins. Use * to allow all origins.
CORS_ALLOWED_ORIGINS=*
Upload a file:
curl -s -X POST http://localhost:8080/v1/files \
-F "file=@./path/to/file.pdf"
Upload with password protection:
curl -s -X POST http://localhost:8080/v1/files \
-F "password=secret123" \
-F "file=@./path/to/file.pdf"
Upload with expiration (optional):
curl -s -X POST http://localhost:8080/v1/files \
-F "expires_at=2026-12-31T23:59:59Z" \
-F "file=@./path/to/file.pdf"
Response:
{"file_id":"...","filename":"file.pdf","content_type":"application/pdf","size_bytes":12345,"expires_at":"2026-12-31T23:59:59Z"}
Download (302 redirect to signed URL, 60s TTL):
curl -v http://localhost:8080/v1/files/<file_id>/download
# For password-protected files, send the password in the request body:
curl -v -X POST http://localhost:8080/v1/files/<file_id>/download \
-H "Content-Type: application/json" \
-d '{"password":"secret123"}'
Content type
Image
Digest
sha256:6e5a898b2…
Size
16.4 MB
Last updated
5 months ago
docker pull 0x1115/uploader