File storage for your app
Instroc Cloud includes file storage, so your app can accept uploads and serve images and documents without any external service. This page explains the two buckets, the Storage panel in the editor, how apps upload and display files, and what storage costs.
Like the rest of Cloud, there is nothing to set up. The moment Cloud is enabled, your app can store files, and Roc uses this storage automatically when it builds features that involve uploads.
Public and private buckets
Every project has two buckets, and the one you choose decides who can see a file:
- Public bucket. Anyone with the link can view the file. Use it for content that is meant to be seen, like product photos, blog images, or a logo.
- Private bucket. Only signed-in users of your app can access the file. Use it for anything personal or restricted, like uploaded documents or content behind a login.
Each file can be up to 50 MB. If your app needs both kinds of content, use both buckets; the choice is made per upload, not per project.
The Storage panel
Open Instroc Cloud, then Storage, to manage your app's files directly. You can upload files yourself, browse everything the app has stored in a table view, and preview files without leaving the editor. It is the quickest way to seed an app with real images, check what users have uploaded, or remove something that should not be there.
How apps upload and display files
Your app's code works with storage through simple hooks. Uploading is one call that returns the stored file, including a URL you can render immediately:
const { upload, uploading } = useFileUpload();
async function onAvatarPicked(file: File) {
const stored = await upload(file, { bucket: 'public', path: 'avatars' });
// stored.url is ready to use in an <img> tag
}
Displaying a file is just using its URL. There are matching hooks for listing files and deleting them. Roc writes this code for you when you ask for an upload feature, so you will mostly see these hooks rather than write them. The full details, including file metadata and the list and delete hooks, are in the Storage API reference.
You do not need file storage for every image. Roc can source real stock photography automatically for photographic content, so uploads are mainly for files your users provide or brand assets you own.
Typical uses
A few patterns come up in almost every app that uses storage:
- User avatars. Users pick a profile photo, the app uploads it to the public bucket, and the URL is saved on their profile.
- Product photos. You or your users upload images to the public bucket and product records reference the URLs, so listings render real photos.
- Document uploads. Users submit PDFs or other files to the private bucket, where only signed-in users can reach them, and you review them from the Storage panel or an owner-only admin page.
In each case the pattern is the same: upload the file, keep the returned URL or file record in a database table, and render from there. See Database for how those tables work.
What storage costs
File storage bills at $0.02 per GB per month through your Instroc Cloud usage, alongside the rest of what your app consumes. It comes out of your monthly Cloud allowance first, then your Cloud Balance, and an app that stores nothing costs nothing. Rates can change, so check instroc.com/cloud for the current numbers, and see Cloud billing for how allowances, balances, and budgets work together.