Feature Specification: File Storage & Uploads
1. Overview & Vision
The File Storage feature provides the foundational ability to upload, store, and retrieve digital assets. It aims to be the "Hard Drive" of the VENI-AI ecosystem, offering high-performance, secure, and organization-scoped storage for all modules.
2. Personas & Stakeholders
| Persona | Goal |
|---|---|
| User | Upload and manage personal and project files. |
| Admin | Manage organization-wide storage quota and assets. |
| Satellite Service | Programmatically store and retrieve files (e.g., HRM avatars). |
3. User Stories
- As a user, I want to drag multiple documents into Drive so they are stored safely in the cloud.
- As a member, I want to download the latest version of a project brief to work offline.
- As an admin, I want to delete old files to free up organization storage space.
4. Functional Requirements (FR)
- REQ-DR-001: Multi-file upload support (Drag-and-Drop).
- REQ-DR-002: Maximum file size support up to 100MB.
- REQ-DR-003: MIME-type validation and original filename preservation.
- REQ-DR-004: Secure direct-to-S3 streaming for large uploads.
5. Non-Functional Requirements (NFR)
- Scalability: Support for millions of files per organization.
- Availability: 99.9% success rate for file retrieval.
- Security: Files MUST be encrypted at rest in the storage backend.
6. Business Logic & Rules
- Quota Check: Uploads are blocked if the organization's
storage_quotais exceeded. - Streaming: Files are streamed directly to S3 to minimize API memory usage.
- Consistency: Metadata is only committed to SQL after successful S3 confirmation.
7. User Interface (UI/UX)
- File Explorer: Grid and List views with metadata (size, date, owner).
- Upload Queue: Side-drawer showing active uploads and progress bars.
- Preview: Built-in viewer for Images, PDFs, and Plain Text.
8. Information Architecture
- Root "Drive" navigation.
- Nested folder structure (See Folder Org feature).
9. Data Model & Persistence
- Table:
files. - Backend: S3-compatible (MinIO / AWS S3).
- Pathing:
s3://{orgId}/{fileId}_{filename}.
10. API & Service Layer
POST /files(multipart/form-data)GET /files/:id/download(Redirects to presigned URL)DELETE /files/:id
11. Integration Patterns
- presigned URLs: Generated by the API for secure, time-bound direct downloads from S3.
- Inter-service: HRM uses the internal
StorageServiceto manage avatars.
12. Security & Permissions
- RBAC:
drive:readto view/download;drive:writeto upload/delete. - Isolation: Every request is validated against the user's
organizationId.
13. Error Handling & Resilience
- Multipart Failures: Automated retry logic for failed chunks (planned).
- Graceful Error: User-friendly messages for "Quota Exceeded" or "File Too Large".
14. Performance & Scalability
- Parallel uploading for multiple files.
- CDN integration for public assets (planned for v1.5).
15. Globalization & i18n
- Support for non-Latin character sets in filenames (UTF-8).
16. Accessibility (a11y)
- Aria-live regions for upload progress announcements.
- Keyboard-accessible file selection and context menus.
17. Observability & Analytics
- Tracking of "Storage Consumption" trends per organization.
- Monitoring of "Upload Latency" and "Failure Rates".
18. Testing & Quality
- Integration tests using a local MinIO container.
- Stress testing for high-concurrency upload scenarios.
19. Constraints & Assumptions
- Assumes organization has an active subscription with storage quota.
20. Future Enhancements
- Video transcoding and streaming.
- Intelligent tagging using computer vision (v2).