Once the AI adds file storage to your project, it generates all the code needed for uploading, retrieving, and managing files. Here is what that looks like from both the app builder's and app user's perspective.
Uploading files
When a user uploads a file in your app, the upload happens directly from their browser to Caffeine's storage infrastructure. Large files are split into 1 MB chunks and uploaded in parallel — up to ten chunks simultaneously — so uploads are fast even for large files. The upload process also verifies integrity: each chunk is checked against a cryptographic hash to confirm nothing was corrupted in transit.
After all chunks are received, the file reference is recorded in your app's canister. From that point, the file is permanently associated with whatever data record your app links it to — a post, a user profile, a product, or anything else.
Displaying and downloading files
Files are served directly from Caffeine's storage infrastructure. When your app needs to display an image or offer a download link, the frontend generates a direct URL to the file and hands it to the browser. The canister is not involved in serving the file bytes — the browser fetches directly from the storage layer, which makes retrieval fast and supports streaming for video.
Access control
By default, file storage has no built-in access restrictions. A user who knows a file's URL can access it. How strictly your app controls access to those URLs depends on how you design it.
If you ask the AI to build a file storage feature with access restrictions — for example, "only logged-in users should be able to view uploaded documents" or "only admins can upload files" — it will generate the appropriate authorization logic. File access can be as open or as restricted as your app requires.
Deleting files
When a file is removed in your app — whether by a user action or an admin — the reference is deleted from the canister. Caffeine's infrastructure then detects that the file is no longer referenced and removes it from the storage gateway. This cleanup happens automatically in the background; your app does not need to manage it.
Common patterns the AI builds
Image galleries: Users upload images, which are stored and displayed in a browsable grid. The AI generates the upload form, the gallery view, and the connection between them.
Profile pictures: Each user has an avatar stored as a file reference on their profile record. Uploading a new picture replaces the old one.
Document libraries: Files are uploaded by admins and listed for users to download. Access can be restricted to authenticated users only.
Post attachments: Users attach files to posts, comments, or messages. The attachment is stored alongside the post data and displayed inline or as a download link.
Media management for content creators: Admins upload images and videos to a central asset library, then reference those assets across multiple pages or posts.
Modifying how file storage works in your app
If you want to change how uploads or file management work — add a file size limit, restrict which file types are accepted, change who can upload, or add a progress bar — describe it in the chat. The AI updates the generated code with the next build.
Things to keep in mind
- Files are not version-controlled — uploading a new file with the same name does not replace the old one automatically; your app's logic determines how replacements work
- There are currently no hard limits on individual file size or total storage per project; limits may be introduced in the future
- Storage and bandwidth usage will be reflected as usage-based charges in your Credit Usage screen once usage-based billing is enabled