Many apps built with Lovable, Bolt, Cursor or Replit let users upload something: an avatar, a photo, a PDF. The upload works in the demo, so it looks finished. The hard questions come later. Who can open those files? What happens when someone uploads a 200 MB video? What does it cost when the app gets popular? I checked the facts below against the official docs in November 2026.
Short answer: keep anything private in a private bucket and hand out short-lived links. Set a size limit and an allowed file type on the storage side, not only in the upload form. Resize images before you serve them. Delete the file when you delete the record. Then test an upload from a real phone.
1. Who can see the files
In Supabase Storage, a bucket is either public or private. The bucket docs say a public bucket "effectively bypasses access controls for both retrieving and serving files within the bucket." The downloads page says "all files uploaded in a public bucket are publicly accessible." Anyone with the URL can open the file, no login needed.
That is fine for a logo or a public product photo. It is not fine for passports, invoices, contracts or medical documents. A common mistake in AI-built apps is one public bucket for everything, because that makes the demo work with the least effort. Paths like uploads/invoice-1001.pdf are also easy to guess. Treat a file's URL as public the moment it exists.
For private files, Supabase's docs say that when a bucket is private, "all operations are subject to access control via RLS policies", and that buckets are private by default. To show a private file to its owner, create a signed URL. The createSignedUrl method makes a link "that can be accessed for a limited time." The downloads page says an individual signed URL can't be revoked directly. You have to delete, move or rename the object, so keep the expiry short.
The policies live on a table. Supabase says: "You selectively allow certain operations by creating RLS policies on the storage.objects table." The access control page also says "By default Storage does not allow any uploads to buckets without RLS policies." A policy that only checks the bucket name lets every signed-in user read every file in it. A good one also checks that the first folder in the path is the user's ID. For RLS basics, see the database security checks, because the same rules apply.
Firebase works differently. Cloud Storage uses Security Rules. Firebase's rules overview lists "Mixed access" as a basic use case: "Restrict write access by user, but allow public read access." The user security page shows how to tie a path to a user, for example a rule that allows a write only when request.auth.uid == userId. Check your project's rules for a blanket allow read, write: if true.
2. Size and type limits
Do not trust the upload form. MDN says about the file input's accept attribute that it "doesn't validate the types of the selected files; it provides hints for browsers." It adds that "you should make sure that expected requirement is validated server-side." The real check belongs in the storage rules or on the server. The same rule holds for every other form field: see why browser form checks aren't enough.
On Supabase, the limits sit in two places. The file limits page describes a global limit that applies to all buckets. It says "For Free projects, the limit can't exceed 50 MB", and that on the Pro Plan and up you can raise it to a higher maximum. You can also set a smaller limit per bucket, and "it can't be higher than this global limit." The bucket docs add that "Upload restrictions like max file size and allowed content types are also defined at the bucket level." For an avatar bucket, set a small limit and allow only image types.
On Firebase, you do it in the rules. The user security page says rules can check "file metadata properties such as contentType and size", and its own example allows an image upload only if request.resource.size is under a limit and request.resource.contentType matches image/.*.
One more habit: do not use the original file name as the stored path. Generate your own name, and keep the original as text in your database. A check on contentType is a useful guard, but it is not a virus scan.
3. Images: resize before you serve them
A photo straight from a phone camera can be several megabytes. Shown as a small avatar, it is still a big download. That makes pages slow, as I wrote in why AI-built apps are slow. The simplest fix is to resize on upload and store a smaller copy.
Supabase can also resize on the fly. Its image transformations page says "Image Resizing is currently enabled for Pro Plan and above." It lists limits: width and height "must be an integer value between 1-2500", the image "cannot exceed 25MB", and the resolution "cannot exceed 50MP". The Storage pricing docs note that image transformations incur additional charges, so read them before you turn this on.
On formats, MDN says WebP "now has broad support in the latest versions of major web browsers", and recommends a JPEG or PNG fallback. Phones can also send photo formats your app doesn't expect, so test an upload from an iPhone and an Android phone yourself.
4. What it costs
Storage has two cost lines: what you keep, and what you send out. Supabase's egress page says "You are charged for the network data transmitted out of the system to a connected client", and that "Egress is charged by gigabyte." The Storage pricing docs above say "You are charged for the total size of all assets in your buckets", and that you only pay for usage above your plan's quota. See Supabase's pricing page for the current amounts.
On Firebase, Cloud Storage needs a paid plan. Firebase's storage FAQ says "Cloud Storage for Firebase (even default buckets) now requires projects to be on the pay-as-you-go Blaze pricing plan." The Firebase pricing page says fees on newer default buckets are processed as Google Cloud Storage usage fees, and that no-cost limits are enforced daily.
Surprises mostly come from files that are loaded often. A large image on a busy page, or a file someone links from another site, is downloaded again and again, and the egress adds up. Resizing helps most. For the rest of the monthly picture, see what a small web app costs to run.
5. Deleting files
When a user deletes their account, or a record with a photo, the file often stays behind. The row is gone, but the file is still in the bucket, still costing storage and still holding someone's data. See the GDPR checklist for small apps.
On Supabase, there is a trap. The delete page says "Deleting objects should always be done via the Storage API and NOT via a SQL query", because deleting via SQL "will not remove the object from the bucket and will result in the object being orphaned." It also says deleted files are "permanently removed and not recoverable." Database backups do not cover this; see database backups.
On Firebase, you call delete() on a file reference. The delete docs add that "Deleted files are typically recoverable for 7 days with soft delete, which is enabled by default." Either way, make sure your "delete account" flow removes the files too, and now and then look for files that no record points to.
6. What breaks at launch
Files that pass through a serverless function. If the browser sends the file to your function, which then saves it, you hit the function's size limit. Netlify's function defaults list a buffered request payload of 6 MB and a synchronous execution limit of 60 seconds. Their footnote says image uploads and other binary payloads are Base64-encoded, which "adds approximately 30% overhead", effectively reducing the binary request limit to 4.5 MB. Vercel's limits page says "The maximum payload size for the request body or the response body of a Vercel Function is 4.5 MB", and that a larger request returns a 413 error. A phone photo can be bigger than that.
The usual fix is to let the browser upload straight to storage, with your function only deciding who is allowed. Supabase also says its standard upload method is "ideal for small files that are not larger than 6MB" and recommends resumable uploads for larger files.
Direct downloads in the browser. Firebase's download docs say "To download data directly in the browser, you must configure your Cloud Storage bucket for cross-origin access (CORS)." If images work in development but fail on your live domain, look at CORS.
Uploads that fail only on phones. Big photos on a weak connection are a common cause. Show a readable error, not a spinner that never ends. See also apps that look broken on phones.
Prompts for your AI tool
Name the bucket, the rule and what must not change.
- "List every storage bucket this app uses and whether it is public or private. For each, list which file types are stored in it. Don't change anything yet."
- "Make the 'documents' bucket private. Show files to their owner with signed URLs that expire after a few minutes. Add a storage policy so a user can only read and write files under their own user ID folder. Keep the UI exactly the same."
- "Set a maximum file size and allowed image types on the 'avatars' bucket, and also check them in the storage policy or rules, not only in the upload form. Show a clear error message when a file is rejected."
- "When a user deletes their account or a record with a file, also delete the file through the Storage API. List any place where we currently delete rows but not files."
The tool may say a bucket is private when it is not. Test it: open a file URL in a private browser window where you are signed out.
Checklist
- Every bucket is marked public or private on purpose. Private documents are not in a public bucket.
- Private files are shown with short-lived signed URLs.
- Storage policies or rules check who owns the file path, not only the bucket name.
- Size and file type limits are set on the storage side, not only in the form.
- Images are resized before they are served.
- You know where storage and download costs show up in your plan.
- Deleting a record or account also deletes its files, through the Storage API.
- Uploads work on a real phone, on a slow connection, and on your live domain.
- No function in the upload path has a smaller size limit than your biggest upload.
Before a launch, also go through the launch-ready checklist.
Want this fixed for you?
I finish and fix apps built with Lovable, Bolt, Cursor or Replit, including locking down file uploads and storage rules. Or send me the details and I'll reply within 24 hours.