All projects
Project case study
Chunked File Storage API
A FastAPI service for direct and multipart uploads to MinIO, with MIME and size validation, SQLite metadata, chunk merging, and streamed downloads.
FastAPIMinIOSQLAlchemySQLite
Open source repositoryThe problem
Accept direct uploads and split uploads into validated parts before storing the completed object.
Request flow
- 01Validate file and upload session
- 02write numbered chunks
- 03verify and merge all chunks
- 04upload object and save metadata
Example route: POST /files/multipart/init
Implementation decisions
- Support JPEG, PNG, PDF, and plain-text MIME types with a 10 MB maximum size.
- Track upload IDs, expected chunk count, declared size, and file metadata in SQLAlchemy / SQLite.
- Use UUID object names and stream downloads in 1 MB blocks.
Validation and failure handling
- Reject invalid chunk numbers, missing chunks, and size mismatches.
- Remove temporary chunks after a completed upload.