StoicBuilder

HandbookII the ForumFile storage

IIthe Forum, The shape of an app

File storage

1 min readUpdated 28 November

In plain words

File storage is a separate service, such as Supabase Storage or Amazon S3, that keeps uploaded files and gives each one a path your database can save.

Where you see it

The Storage section in Supabase, with buckets like avatars and receipts. Guildhall's profiles table holds avatar_url, a short path, while the picture itself sits in the avatars bucket.

src/lib/avatar.tsbrowser
const path = `${user.id}/avatar.png`;await supabase.storage.from("avatars").upload(path, file, { upsert: true });await supabase.from("profiles").update({ avatar_url: path }).eq("id", user.id);
The file goes to the bucket. The table only keeps where it is.

What goes wrong

  1. Saving the image inside the database

    A picture turned into a long string of text, called base64, and saved in a text column makes the table balloon. Every query slows down and backups get huge.

    avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg..."
  2. A public bucket for private files

    Anyone with the link can open a file in a public bucket. Receipts and ID scans belong in a private bucket, shared through links that expire.

  3. Deleting the row but not the file

    Remove a member and their avatar stays in storage, costing money and holding personal data you promised to delete.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Store uploaded files in the project's file storage, such as Supabase Storage or S3, never inside a database column, and save only the file's path in the table. Keep buckets private unless the files are meant to be public, and delete the file when its row is deleted.

Quick check

Sign in to earn +10 XP for it

Guildhall's members page has slowed to a crawl, and the profiles table is 2 GB for 3,000 members. What's filling it up?

Got a prompt that touches file storage?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.