Repository navigation
Media and Storage
This page documents the current media upload and storage behavior.
Tapitude currently stores uploaded files on the local filesystem.
Physical files are stored in:
storage/The server exposes that folder at:
/storageExample public file URL:
/storage/<fileKey>Older wiki references to uploads/ or GET /uploads/:filename do not match the current codebase.
File metadata is stored in MongoDB through the File model inside:
src/models/FileService.tsImportant metadata fields:
fileKey
originalName
contentType
fileSize
ownerId
createdAt
isActiveContent posts store media through:
ContentPage.fileKeyCreator profile images are stored through:
CreatorProfile.profileImageKeyThe file key points to file metadata and to the physical file in storage/.
Current editor behavior supports one media file per post.
The post editor accepts:
image/*
video/*Upload route:
POST /creator/pages/uploadThe upload flow:
- Browser submits the media form.
- Controller streams the upload with Busboy.
-
FileService.uploadFilesaves the physical file. -
FileServicecreates MongoDB file metadata. - The content page stores the returned
fileKey. - If the post already had media, old media is deleted.
Creator profile updates can include a profile image.
If a creator uploads a new profile image, the old image should be deleted when the key changes.
Media should be deleted when:
- A creator removes media from a post.
- A creator replaces media on a post.
- A creator deletes a post.
- The system deletes the oldest post because the creator exceeded the post limit.
- A profile image is replaced.
Recommended additional review:
- Confirm admin creator deletion removes related posts and media.
- Confirm media upload/update routes are creator-owner scoped.
- Add tests for media deletion to avoid orphaned files.
Local storage is fine for development and controlled demos, but production should use durable object storage.
Recommended future providers:
- AWS S3
- Cloudflare R2
- Azure Blob Storage
- Google Cloud Storage
- Sponsor-approved storage
Keep FileService as the abstraction so controllers do not need to know whether files are local or cloud-hosted.
Before production, confirm:
- Maximum file size.
- Allowed MIME types.
- Whether videos are required.
- Whether documents/PDFs are allowed.
- Whether one post can ever have multiple files.
- Whether uploaded media needs moderation.