84 84. Step 10: Set Up Supabase Storage Bucket
As of Oct 22, 2026 · Official docs: Supabase Storage
You’ll store task images in Supabase Storage, in a bucket: a named container for files, like a top-level folder in a cloud drive.
84.1 The Migration Already Created the Bucket
You don’t create the bucket by hand, so skip any manual bucket steps you may find in older instructions. The migration supabase/migrations/3_init_storage_schema.sql, which ran when Claude ran npx supabase db push for you in Step 9 ((G) Create the database in Classes 10–12), already created it, with its settings and policies. The bucket is named task-attachments, the name the app’s code uses.
task-images bucket
Earlier versions of this page told you to create a bucket named task-images. The app never uses a bucket with that name. If you created one, you can delete it.
84.2 What the Migration Set Up
Bucket settings:
- Public: anyone who has an image’s URL can view it (simpler for tutorials). For production, consider a private bucket with signed URLs, links that work only for a limited time.
- File size limit: 1 MB. Supabase refuses larger files, whatever the upload page does. (An upload page can also check the size first, to give a friendly message before the file is sent.)
- Allowed file types: images only:
image/jpegimage/pngimage/gifimage/webp
Storage policies (rules that Supabase checks on every request):
- Anyone can view the files.
- Signed-in users can upload files, but only into a folder named after their own user ID. The app saves each image under a path that starts with the uploader’s ID.
- Signed-in users can delete files only in their own folder.
The migration also deletes a task’s image from storage when the task is deleted.
84.3 Check It in the Dashboard
- In the Supabase dashboard, open Storage. You should see the
task-attachmentsbucket, marked as public. - Open the bucket’s settings (its Edit option) to see the size limit and the allowed file types.
- Open the storage Policies page to see the three policies.
If the bucket is missing, npx supabase db push didn’t finish. Run it again and read its output for errors.
Practice Questions
Easy
Question 1 · Short answer
What is a Supabase Storage bucket, and what does this app keep in it?
Question 2 · Multiple choice
The migration makes the bucket Public. What does that setting mean?
- Anyone on the internet can upload files to the bucket
- Anyone who has a file’s URL can view that file
- Anyone can delete files from the bucket
- Only the user who uploaded a file can view it
Question 3 · Multiple choice
The bucket allows only the file types image/jpeg, image/png, image/gif and image/webp. Which of these files would be rejected? (Assume every file is under the size limit.)
team-photo.jpglogo.pngbudget-report.pdfcelebration.gif
Question 4 · True or false
You have to create the storage bucket and its policies by hand in the Supabase dashboard before the app can store images.
Medium
Question 5 · Matching
Match each setting or policy with what it does.
| Setting or policy | What it does | |
|---|---|---|
| 1. Public bucket | A. Only signed-in users can add files | |
| 2. Private bucket + signed URLs | B. A user can remove only their own images | |
| 3. Upload policy | C. Anyone who has a file’s URL can view it | |
| 4. Delete policy | D. Files can be viewed only through special links that the app hands out |
Question 6 · Short answer
Earlier versions of this page told students to create a bucket named task-images by hand, but the app’s code uses a bucket named task-attachments. Why must the bucket’s name match the name used in the code, and what happens if it doesn’t?
Question 7 · Scenario
Maria tries to attach a 3 MB photo of a whiteboard (a PNG file) to one of her tasks. The bucket’s size limit is 1 MB. What should happen? Is this a bug?
Question 8 · Scenario
When a signed-in user tries to upload an image from the app, the upload fails with an error like “new row violates row-level security policy”. Based on this page, what is most likely missing, and how could you fix it?
Hard
Question 9 · Long answer
A file-size limit can be enforced in the upload page (the UI) and on the server (here, the bucket’s own 1 MB limit in Supabase). Explain what each of these two places adds, and why a check only in the upload page is not enough.
Question 10 · Scenario
Suppose the app saves each image under a path that starts with the uploader’s user ID, for example maria-user-id/whiteboard.png (in real life the ID is a long random string). Explain how a delete policy can use that path so that Sam cannot delete Maria’s image.
Question 11 · Compare
The page calls a public bucket “simpler for tutorials” but suggests a private bucket with signed URLs for production. Imagine the app adds a feature where employees upload photos of expense receipts. Which option would you choose, and why? Mention one downside of your choice.