1 min read

Manually Backup Supabase Postgres Database

Backup a free-tier Supabase DB with a shell script.

ByAmir Ardalan
Share on X

What's This For?

Supabase's free-tier Postgres offering doesn't come with a backup feature. If you need to make a quick copy of your database, its possible to manually back it up with a simple pg_dump bash script.

This guide assumes you have a Postgres database on Supabase and have Homebrew installed.

Install Postgres

1brew install postgresql 2

Check out the official documentation for detailed instructions. There is also info on how to switch versions if you have a version mismatch with your database.

Create a Backup Script

Go to your Supabase Dashboard, select your DB, and click the Connect button for the details you need to complete this script:

1pg_dump 'postgres://postgres.[username]:[password]@[host].supabase.com:5432/postgres' > prod_db_backup.sql 2

Run the Script

Now that you've formed your backup script, simply run it in your Terminal. Your backup file will appear in the directory that you run the script in. If you need to automate the backups, this script would be a good starting point.

Reach out to me on X if you have any questions.

Did you enjoy this post?

© 2024 Amir Ardalan0 views