All articles

How to Backup Your Supabase Database for Free

The Guide to Creating Database Backups Without Paid Plans

Bob⚡James
· 7 min read

You've built an amazing application with Supabase, and it's ready to go live.

But there's one critical problem: Your entire database exists solely in Supabase's cloud, and backup features are locked behind paid plans.

What happens when hardware fails? When hackers attack? When something goes wrong and you need to restore your data?

Without backups, you're one incident away from losing everything.

👉 Here's how to create reliable database backups on Supabase's free tier.


What You'll Learn in This Backup Guide 🚀

This isn't theoretical - it's a practical, tested approach to backing up Supabase databases without paying for premium features.

You'll master:

  1. The Backup Reality: Why Supabase locks backups behind paid plans and what that means
  2. PostgreSQL Setup: Installing the tools you need for database backups
  3. Connection Troubleshooting: Solving the most common connection issues that block backups
  4. Backup Execution: Step-by-step commands that actually work
  5. Verification Process: How to ensure your backups are complete and usable

By the end of this guide, you'll have a working backup system and the knowledge to automate it.

Ready to protect your data? 💾



The Harsh Reality of Supabase Free Tier Backups

When you're building on Supabase's free tier, you expect basic features like database backups to be available.

They're not.

Supabase reserves backup functionality for paid plans only. No simple download button, no automated backups, no easy export options.

This creates a serious problem:

  • Your code is safe (it's in GitHub)
  • Your database? It exists only in Supabase's cloud
  • If something goes wrong, you have no recovery options

The solution: Use PostgreSQL's native tools to create your own backups.


Understanding Your Backup Options

Before diving into the technical steps, let's understand what we're working with.

The Official Supabase Approach

Supabase documentation suggests using their CLI with commands like:

Shell
supabase db dump --db-url [CONNECTION_STRING] -f roles.sql --role-only
supabase db dump --db-url [CONNECTION_STRING] -f schema.sql  
supabase db dump --db-url [CONNECTION_STRING] -f data.sql --use-copy --data-only

The problem: This approach requires Docker Desktop and additional setup complexity.

The PostgreSQL Direct Approach

What we'll use instead: PostgreSQL's pg_dump utility, which:

  • Works without Docker
  • Requires only PostgreSQL installation
  • Provides complete database dumps
  • Works reliably across platforms

This is the same tool Supabase uses internally for their paid backup service.


Step 1: Install PostgreSQL Tools

First, you need PostgreSQL installed locally to access the pg_dump utility.

Linux (Arch) Installation

Shell
# Update your system first
pacman -Syu

# Install PostgreSQL
pacman -S postgresql

Other Platforms

Windows, macOS, and other Linux distributions: Download installers from PostgreSQL.org

What you're installing: You don't need a full PostgreSQL server - just the client tools that include pg_dump.


Step 2: Get Your Supabase Connection Details

This is where most backup attempts fail. You need the correct connection string, and Supabase has multiple options.

Reset Your Database Password

  1. Navigate to Settings: Go to Settings > Database in your Supabase dashboard
  2. Reset Password: Click "Reset database password" and save the new password
  3. Important: You'll need this password for the connection string

Get the Connection String

  1. Click Connect: In the top bar of your Supabase dashboard
  2. Choose Connection Type: You'll see multiple options
  3. Critical Decision: This is where most people get stuck

You'll see two main options:

Direct Connection (Usually Doesn't Work)

Shell
postgresql://postgres:[YOUR-PASSWORD]@db.[YOUR-PROJECT-REF].supabase.co:5432/postgres

Why it fails: Most ISPs don't support IPv6, and this connection often gets blocked.

Session Pooler (This Works)

Shell
postgresql://postgres.[YOUR-PROJECT-REF]:[YOUR-PASSWORD]@[YOUR-REGION].pooler.supabase.com:5432/postgres

Why this works: Session pooler connections are IPv4 proxied and work with most network configurations.

Key difference: Notice the format difference - postgres.[YOUR-PROJECT-REF] vs just postgres, and the pooler.supabase.com domain.


Step 3: Execute the Backup

Now comes the actual backup process.

The Basic Command

Shell
pg_dump --dbname="postgresql://postgres.[YOUR-PROJECT-REF]:[YOUR-PASSWORD]@[YOUR-REGION].pooler.supabase.com:5432/postgres" --disable-triggers > supabase-dump.sql

Understanding the Options

--dbname: Specifies the database connection string
--disable-triggers: Prevents trigger execution during restore (essential for data integrity)
> supabase-dump.sql: Outputs the backup to a file

Common Error and Solution

If you see this error:

Shell
pg_dump: error: connection to server at "db.[YOUR-PROJECT-REF].supabase.co" failed: Network is unreachable

Solution: You're using the direct connection string instead of the session pooler. Switch to the pooler connection string.


Step 4: Verify Your Backup

Don't assume your backup worked - verify it.

Check File Size

Shell
ls -lh supabase-dump.sql

What to look for: The file should be larger than a few KB. Empty or tiny files indicate backup failure.

Scan the Contents

Shell
head -n 50 supabase-dump.sql
tail -n 50 supabase-dump.sql

What you should see:

  • SQL CREATE statements for your tables
  • INSERT statements with your actual data
  • Database schema definitions

Validate Structure

Shell
grep -c "CREATE TABLE" supabase-dump.sql
grep -c "INSERT INTO" supabase-dump.sql

Expected results: Numbers that match your actual table and record counts.


Troubleshooting Common Issues

Here are the problems I encountered and how to solve them:

Connection Refused Errors

Problem: connection to server failed: Network is unreachable

Solution: Switch from direct connection to session pooler connection string.

Authentication Failures

Problem: password authentication failed

Solution:

  1. Reset your database password in Supabase
  2. Use the exact password immediately (they expire quickly)
  3. Ensure no extra characters in your connection string

Empty Backup Files

Problem: Backup completes but file is empty or tiny

Solution:

  1. Check your database actually has data
  2. Verify connection string is correct
  3. Ensure you have read permissions

IPv6 Network Issues

Problem: Connection timeouts or network unreachable

Solution: Always use the session pooler connection string - it's IPv4 compatible.


Next Steps: Automating Your Backups

Now that you have a working backup process, consider automation:

Create a Backup Script

Shell
#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%S)
pg_dump --dbname="your-connection-string" --disable-triggers > "backup_${DATE}.sql"
gzip "backup_${DATE}.sql"

Schedule Regular Backups

Linux/macOS: Use cron jobs
Windows: Use Task Scheduler
Goal: Daily or weekly automated backups

Consider Storage

Local storage: Keep recent backups on your machine
Cloud storage: Upload compressed backups to AWS S3, Google Drive, or similar
Version control: Consider storing schema changes in Git


The Bottom Line: Your Data Is Worth Protecting

Supabase is an excellent platform, but their free tier backup limitations create real risk.

With this approach, you now have:

  • Complete database backups on demand
  • No dependency on paid plans
  • Full control over your backup schedule
  • Recovery options when things go wrong

The effort is minimal, but the protection is invaluable.

Don't wait until you need a backup to create one. Hardware fails, services have outages, and mistakes happen.

Your data is irreplaceable. Your backup strategy shouldn't depend on upgrading to paid plans.


Ready to Secure Your Database?

You now have everything needed to backup your Supabase database reliably and for free.

Your next step: Execute your first backup today. Don't wait, don't procrastinate.

Test the process, verify the results, and set up automation. Your future self will thank you when you need to restore from backup and actually have one.

What backup schedule will you implement? 💾


Advanced Backup Considerations

Want to take your backup strategy further? Consider these enhancements:

Comprehensive Backup Types

Schema-only backups: Structure without data
Data-only backups: Content without structure
Complete backups: Everything together (recommended for most cases)

Compression and Storage

Compress backups: Use gzip to reduce file sizes
Encrypted storage: Protect sensitive data in backups
Multiple locations: Store backups in different physical locations

Testing and Validation

Regular restore tests: Ensure backups actually work
Automated validation: Scripts that verify backup integrity
Documentation: Record your backup and restore procedures

Remember: A backup you can't restore is useless. Test your recovery process regularly.

Comments

Please sign in to leave a comment.

No comments yet. Be the first to comment!