#tools

2 min read

views

Manually Backup Supabase Postgres Database

By Amir Ardalan
#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.

Note

This guide assumes you have a free-tier Postgres database on Supabase.

#Install Postgres
brew install postgresql
bash

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. Be sure to get the params from the "Session Pooler" connection string (we want IPv4). Click on the "View parameters" button under "Session Pooler" to help you form the string:

pg_dump postgresql://[user]:[password]@[host]:[port]/[database] > your_db_backup.sql
bash
#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.

Enjoy this post? Like and share!