Skip to content
Smoonb logo
All articles
Storage in practice9 min read

Supabase Storage Cleanup: Backups and File Retention

The Supabase email arrived. The bucket had grown. What would you delete first?
A case from developing Ponte App for Clínica da Ponte: accumulated files, deliberate cleanup, and the value of having a backup before changing Storage.

Illustration of files accumulating in a bucket, an independent backup copy, and a file rotation cycle.
A Storage maintenance routine: preserve files, review them, and keep accumulation under control.

Have you ever opened the Supabase dashboard and wondered, “How did this bucket get so full?”

A test upload here. A new version there. Another export, another temporary file. Development moves on — and Storage keeps holding on to everything.

That happened in the development environment for Ponte App, which we are building for Clínica da Ponte. Files accumulated until the problem landed in our inbox.

How do you free space without deleting files the application needs?

Inventory objects, check their application references, preserve the files in a backup and approve a removal list. Delete only the approved objects through the Storage API, then check the application. An old date alone does not make a file disposable.

Go to the six-step cleanup guide

The warning that moved cleanup off the “later” list

Supabase emailed us to say that the organization had exceeded its usage quota. The warning identified Storage size and advised reducing usage or increasing plan capacity.

The question changed from “When will we organize this?” to “What can we remove without losing anything we still need?”

The bucket held more than the application needed

In our case, development files were accumulating: test outputs, old versions, and artifacts from attempts we would no longer use. Each round left a little more behind.

Before cleaning up, we needed to separate files the application still referenced from those we could discard. An old file can still be necessary. A recent file can already be an unused temporary artifact.

More capacity can make sense when the product needs that space. For the unused files accumulating in this environment, we needed a maintenance policy.

Smoonb: a backup before you click delete

This is where Smoonb fits into the workflow. Having a backup tool ready helps you prepare for maintenance: preserve project content, check the saved files, and then decide what to remove.

The backup needs to include the Storage files.

Smoonb lets you include bucket objects in your backup. Check that this step completed and inspect the preserved files before proceeding with cleanup.

That detail matters: a Supabase database backup contains Storage metadata, but not the files uploaded to buckets. Images, documents, and other objects need to be preserved too.

When preparing a cleanup, keep your copy outside the set of files you will remove. Check that it contains what you need and plan how to restore it. Prepare your recovery option before deciding what to delete.

To review what your backup should cover, use our Supabase backup checklist.

Planning maintenance on your project?

Prepare your first backup with SmoonbFive days free from your first license. No credit card.

How to plan Supabase Storage cleanup

This guide adapts the case’s approach for reviewing your own project. Retention criteria depend on your application; do not copy a deadline or empty a bucket without checking its files.

  1. Build a complete inventory without deleting anything.

    Record each object’s bucket, path, size and date. In the Dashboard or Storage API listings, go through every page and folder. Compare paths with the application’s references: database records, documents, versions and ongoing jobs. Stop the review if the listing is incomplete.

  2. Separate retained files from review candidates.

    Keep files still in use, versions with dependencies and any object whose purpose is uncertain. A removal candidate needs a verifiable reason, such as an unreferenced temporary file past the retention period defined for its purpose. Record the reason for each path; do not rely on file age alone.

  3. Back up and inspect the preserved objects.

    With Smoonb installed locally and configured for the source project, start backup and select the Storage component. Include the database to preserve related records and policies as well.

    npx smoonb backup

    Check the run summary, the .storage.zip archive, expected paths and a sample of opened files. Metadata without objects is not a backup of uploaded files. Resolve failures before continuing and keep the copy outside the deletion set. If you have not proven recovery from this kind of backup, rehearse in a separate destination before removing the originals.

  4. Approve an exact removal list.

    Review the inventory with the person responsible for the application. For every candidate, check its path, reason and presence in the backup when preservation is required. Recheck references before execution: new uploads or changes may have altered the situation since the first listing.

  5. Delete through the Storage API in reviewed batches.

    Use the approved paths in the object deletion operation. Do not run DELETE directly against storage.objects: it removes metadata rather than the stored files and can leave orphaned objects. Supabase documents a limit of 1,000 objects per remove() call; smaller batches make failures and results easier to review. Preserve the project’s permissions and record each batch’s result.

  6. Verify the result and monitor retention.

    List objects again, check the removed paths and open files that should remain. Test the flows that use those uploads and monitor the usage dashboard. If a file is missing or a permission error appears, stop further deletions and investigate. Only then turn the reviewed criteria into an application retention routine.

Smoonb handles backup preparation and recovery. Inventory, deletion decisions and retention automation belong to your application’s maintenance. Review Supabase’s deletion documentation before running it.

How we kept files from piling up again

Cleanup freed space. To manage what would come next, we built a rotation routine into the application based on file usage and retention periods.

Files still in use

Anything the application still needs stays protected.

Abandoned temporary files

Files that have served their purpose enter the retention policy.

History without dependencies

Old versions can be removed only after checking whether they are still needed.

In simple terms: abandoned temporary files get an expiration policy; old versions with no references or dependencies become eligible for removal; files the application still uses remain. If the inventory is incomplete, the routine does not run the cleanup.

We built that rotation routine into the application. Smoonb handles backup preparation; the retention policy determines what can be removed. Both practices contribute to project maintenance.

Space came back. The chart shows the change.

The chart shared below shows the usage trend in the dashboard: a period of growth, a drop following the cleanups, and lower usage in the next part of the timeline.

Storage usageDashboard record
Chart from September 4 to October 3 showing storage growth into mid-September and a sharp drop following cleanups.
Storage usage in the dashboard, from September to October. Original image provided by Alexandre, with no changes to the data. Select it to enlarge.
  • Unused files were removed according to defined criteria.
  • Content still needed by the application stayed protected.
  • Retention became part of the application’s maintenance routine.

The lesson for the next project: prepare a backup before maintenance and decide what happens to temporary files from the start.

Questions about cleaning up Supabase Storage

Can I delete an entire bucket to free space?

Only do this after confirming that the application needs none of the files and that anything you must preserve is in a verified backup. In this case, cleanup was selective: files still in use were preserved. Storage object deletion is permanent.

Does Smoonb perform this rotation automatically?

The routine described here was built into the application we are developing. Smoonb is the backup and recovery tool you can use to prepare for project maintenance.

How do I start using Smoonb?

Create your account, generate your first license, and follow the CLI setup in the dashboard. Your free trial lasts five days from the creation of that first license, with no credit card required.

Have a backup ready when the next warning arrives.

Create your account, configure your project, and prepare your first backup with Smoonb. Preserve your files before your next maintenance session.

Try Smoonb

5 days free. No credit card.
Your five days begin when you generate your first license key.