Skip to main content

Supabase Database Backup on the Free Tier⚡

Updated 4 min readMarkdown
Supabase Database Backup on the Free Tier⚡

Since automated backups aren't available on the Supabase Free Tier, I wanted a simple workflow I could run before every migration.


There Are 3 Ways to Backup a Supabase Database

If you're on the Supabase Free Tier, these are the three most practical approaches:

1️⃣ Supabase CLI

The official Supabase method.

supabase db dump

Good for:

  • Official workflow

  • Exporting schema and data

  • CI/CD integrations

⚠️ Requires Docker.


2️⃣ pg_dump (My Preferred Method)

The standard PostgreSQL backup tool.

pg_dump

Good for:

  • Quick backups before migrations

  • No Docker required

  • Fast restores

  • Works directly with Supabase

This is the method I personally use.


3️⃣ GitHub Actions (Automated Backups)

Want backups without remembering to create them?

Use GitHub Actions.

Benefits:

✅ Daily automated backups

✅ Backup history stored in Git

✅ No manual work

✅ Easy disaster recovery

I wrote a complete guide here:

👉 https://blog.akashy.com.np/automate-supabase-database-backups-using-github-actions

⚠️ Never store database backups in a public repository.


Option 1: Backup Using Supabase CLI

Install the Supabase CLI:

npm install supabase --save-dev

or

npm install -g supabase

Docker Requirement

Supabase CLI backup commands require Docker.

Download Docker Desktop:

👉 https://www.docker.com/products/docker-desktop/

Install and start Docker.

Verify:

docker --version

and

docker ps

Create Backup

Full dump:

supabase db dump \
--db-url "YOUR_DB_URL" \
-f backup.sql

Separate dumps:

supabase db dump \
--db-url "YOUR_DB_URL" \
--role-only \
-f roles.sql
supabase db dump \
--db-url "YOUR_DB_URL" \
-f schema.sql
supabase db dump \
--db-url "YOUR_DB_URL" \
--data-only \
--use-copy \
-f data.sql

Option 2: Backup Using pg_dump

This is my preferred approach.

No Docker.

No extra setup beyond PostgreSQL tools.


Install PostgreSQL Tools

Verify installation:

pg_dump --version

Expected:

pg_dump (PostgreSQL) 17.x

Get Your Database Connection String

Inside Supabase:

Settings
→ Database
→ Connection String

Use the Direct Connection endpoint:

postgresql://postgres:PASSWORD@db.xxxxx.supabase.co:5432/postgres

Create Backup

Basic backup:

pg_dump \
"postgresql://USER:PASSWORD@HOST:5432/postgres" \
> backup.sql

I prefer PostgreSQL's custom format:

pg_dump \
"postgresql://USER:PASSWORD@HOST:5432/postgres" \
--schema=public \
-F c \
-f backup.backup

Why?

--schema=public

Backs up only application tables.

Excludes Supabase-managed schemas like:

auth
storage
realtime
supabase_functions

-F c

Creates a compressed PostgreSQL backup.

Benefits:

  • Smaller file size

  • Faster restore

  • More reliable

  • Supports partial restores


My Backup Strategy

Before every migration:

$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"

pg_dump `
"postgresql://USER:PASSWORD@HOST:5432/postgres" `
--schema=public `
-F c `
-f "backups\backup_$timestamp.backup"

Result:

backups/
├── backup_2026-06-23_10-15-20.backup
├── backup_2026-06-25_08-32-10.backup
├── backup_2026-06-27_14-41-55.backup

Now every migration has a rollback point.


Verify the Backup

Check contents:

pg_restore -l backup.backup

You should see your tables listed.

Example:

profiles
friends
notifications
movie_recommendations

If they're there, the backup is likely healthy.


Restore a Backup

Restore using:

pg_restore \
-d "postgresql://USER:PASSWORD@HOST:5432/postgres" \
backup.backup

⚠️ Always test restores on a development database first.

Never test your first restore on production.

More detailed guide onmy blog here - https://blog.akashy.com.np/restore-a-supabase-database-from-sql-backups-step-by-step-guide


My Backup Checklist

Before running:

npx prisma migrate deploy

or

ALTER TABLE ...

I always:

✅ Create a backup

✅ Use timestamped filenames

✅ Verify using pg_restore -l

✅ Store backups outside my laptop

✅ Test restores occasionally


Which Method Should You Choose?

Method Best For
Supabase CLI Official workflow
pg_dump Fast manual backups
GitHub Actions Automated daily backups

My recommendation:

  • Before migrations → pg_dump

  • Daily protection → GitHub Actions

  • Restore testing → Local .backup files

That's the setup I currently use.


Final Thoughts

Backups feel unnecessary right up until the moment you need one.

If you're using the Supabase Free Tier:

  1. Create backups before every migration.

  2. Use timestamped backup files.

  3. Store backups outside your machine.

  4. Test your restores occasionally.

  5. Automate backups when your project grows.

The entire process takes less than a minute and can save hours—or days—of recovery work later.

Happy building 🚀


Supabase Backup Documentation

https://supabase.com/docs/guides/platform/backups

Official CI/CD Backup Workflow

https://supabase.com/docs/guides/deployment/ci/backups


Automate Daily Supabase Backups Using GitHub Actions

👉 https://blog.akashy.com.np/automate-supabase-database-backups-using-github-actions

Restore Supabase Database Backup

👉 https://blog.akashy.com.np/restore-a-supabase-database-from-sql-backups-step-by-step-guide

About the author

  • 🤖 Curious AI enthusiast and Software Engineer with 7+ years of experience. 🛠️ I enjoy getting my hands dirty with new technologies — experimenting, building side projects, and learning by doing. 🚀 Currently exploring how AI can enhance real-world web applications.

One thing about the recommended command, for anyone using it as their only backup: --schema=public leaves out auth, so the file has every table and none of the accounts. As a rollback point before a migration that's fine, because you restore into the same project and the users are still there. Not if the project's gone. Restore into a fresh one and nobody can sign in, and if profiles references auth.users (Supabase's own starter does), pg_restore errors on that foreign key too.

A second, data-only dump of the auth schema covers it. Data only, because a new project already has its own auth tables and what you want back is the rows in them. Putting those back has two traps Supabase documents, triggers that have to be off during the replay and a couple of owner lines to comment out, which is most of what I wrote up here: https://reeve.page/blog/supabase-backup-auth-users

Also, pg_restore -l lists what the dump meant to include, not whether the rows made it in. Restoring into a scratch database and counting a few tables is the check that tells you.

More from this blog