Repository navigation
Add file_storage module with filesystem and S3 backends - #35
Merged
Merged
Conversation
…ider registry Adds a new file_storage module that exposes upload/list/download/delete through `/api/file-storage` plus an Inertia admin page at `/file-storage`. A `StorageBackend` Protocol with a registry pattern lets new providers (Azure Blob, GCS, R2, in-memory, ...) plug in by registering one factory without editing settings, service, or endpoints. The S3 backend is wired through aioboto3 with a presigned-URL download path; the filesystem backend streams bytes via aiofiles. The download endpoint dispatches between the two on the backend's `supports_presigned_url` capability flag — no provider-specific branching in the service. Every literal (permissions, events, routes, table names, i18n keys, defaults) lives in `constants.py`; tests assert the registry extensibility and round-trip both backends (S3 via ThreadedMotoServer). Also fixes the i18n manifest emitter to use single quotes so its auto-regenerated `keys.generated.ts` no longer fights with the project's biome formatter. https://claude.ai/code/session_01PS5Dk1UvtZaf8f5CPWqo7e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a complete file storage module with pluggable backends, REST API, and web UI for managing uploaded files. Supports both local filesystem and S3-compatible object storage (AWS S3, MinIO, Cloudflare R2, etc.).
Key Changes
Core Service & Orchestration
Storage Backends
StorageBackendprotocol with capability flags (supports_presigned_url) for capability-based dispatchREST API
POST /api/file-storage/upload: Upload with validation, returns metadata + checksumGET /api/file-storage/files: Paginated file listingGET /api/file-storage/files/{id}: Fetch single file metadataGET /api/file-storage/files/{id}/download: Download (streams or redirects based on backend)DELETE /api/file-storage/files/{id}: Delete file and metadataWeb UI
Database & Models
file_storageschema (PostgreSQL) with indexed columnsConfiguration & Settings
SM_FILE_STORAGE_*prefix./uploads/Events & Integration
FileUploaded,FileDeletedpublished to event busTesting
Notable Implementation Details
https://claude.ai/code/session_01PS5Dk1UvtZaf8f5CPWqo7e