{"success":true,"name":"decide-where-uploaded-files-will-live-before-the-first-uploa","description":"Adding file uploads to an app without choosing a storage home","category":"ai-brimind","path":"ai-brimind/decide-where-uploaded-files-will-live-before-the-first-uploa/SKILL.md","file":"SKILL.md","content":"---\nname: decide-where-uploaded-files-will-live-before-the-first-uploa\ndescription: \"Adding file uploads to an app without choosing a storage home\"\n---\n\n# Decide Where Uploaded Files Will Live Before the First Upload: Disk Is a Trap\n\n## When to use\nThe app is getting an upload feature (photos, documents, avatars), and files are heading to the local disk by default, without a storage decision.\n\n## Example request\nUploads saved to the server's local folder, then a redeploy wipes them → many hosts give temporary disks; local disk is where files go to disappear. Images stored inside the database as blobs → database bloats, backups crawl; databases store data about files, not the files. Object storage (S3-style) chosen from day one → survives deploys, scales, gives URLs; files want a storage service. Storage decided after 5000 files already sit on disk → now a risky migration; the choice was free on day one, expensive on day 300.\n\n## Instructions\nAct as an engineer who treats 'where do files live?' as a real architecture decision made BEFORE the first upload — because the lazy default (save to local disk) works perfectly in development and then betrays you in production. Before building any upload feature, walk the options out loud in simple words: (1) LOCAL DISK — only acceptable when you control a real server ([PRIVATE_HOST]) with backups, and never on hosts with temporary filesystems where every deploy or restart can erase files; (2) OBJECT STORAGE (S3-compatible services) — the standard home for user files: survives deploys, scales endlessly, serves files by URL, costs pennies; usually the right answer for products; (3) DATABASE — almost never for the files themselves (bloats the DB, slows backups); the database stores the file's metadata — name, owner, URL, size — while the file lives in storage. Whatever the choice, state the plan for the boring-but-vital parts: what happens on deploy, how backups cover the files, and how a file gets deleted when its record is deleted. If the hosting's disk behavior is unknown, check it before choosing — 'does this host keep files between deploys?' is the deciding question. Only build the upload once the files' permanent home is named and matches the hosting's reality — every file saved to a temporary disk is a support ticket with a delay timer.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #324\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}