This tool provides a secure, automated way to backup your Supabase PostgreSQL databases. It now offers two modes of operation:
- Supabase Manager (GUI): A user-friendly desktop application to manage environments, retention policies, and trigger backups manually.
- Backup Engine (CLI): A headless executable designed for Cron jobs, GitHub Actions, and automated scheduling.
CLI
PORTABLE GUI
- 🆕 Modern GUI Dashboard : Manage multiple projects, create configs, and view execution logs in a beautiful Catppuccin-themed interface.
- 🆕 Portable Application : Runs as a standalone Windows executable (
.exe) without needing Python installed. - 🆕 Integrated Config Manager : Create and edit connection details directly inside the app—no more manual file editing.
- Modular Architecture : Splits backups into
roles.sql,schema.sql, anddata.sqlfor granular restoration. - AES-256 Encryption : Automatically compresses and encrypts backups into protected
.ziparchives. - Automated Retention : Built-in policy engine cleans up old backups based on your settings (e.g., "Keep last 5 files").
- Permanent Snapshots : Tag specific backups as "Permanent" to protect them from auto-deletion forever.
- Headless Mode : Full CLI argument support for automation.
Before using this tool, please ensure you meet the following requirements.
Whether you use the GUI or the CLI, this tool requires PostgreSQL Client Tools to be available to perform the actual extraction.
- Option A: Install Globally (Recommended)
- Download and install PostgreSQL Command Line Tools for Windows.
- Option B: Portable Mode
- If you cannot install PostgreSQL globally, download the binaries zip, extract
pg_dump.exe(and its DLL dependencies), and place them inside the same folder asSupabaseManager.exe.
- If you cannot install PostgreSQL globally, download the binaries zip, extract
This tool uses AES-256 encryption to secure your backups. ❌ Windows File Explorer (the default zip tool) cannot open AES-encrypted zip files. It will likely show an empty folder or throw an error.
✅ You must use a compatible tool to extract your backups:
- 7-Zip, NanaZip, PeaZip
- Download the latest Release ZIP (
SupabaseBackupTool.zip) from GitHub. - Extract the folder to a location of your choice (e.g., Desktop or Documents).
- Ensure
pg_dumpis installed (see Prerequisites above). - Double-click
SupabaseManager.exeto launch the dashboard.
- Clone the repository:
git clone [https://github.com/Double77x/supabase-backup-tool.git](https://github.com/your-username/supabase-backup-tool.git) cd supabase-backup-tool - Install Dependencies (Using
uvis recommended for speed):pip install uv uv pip install -r requirements.txt - Run the GUI:
python gui.py
The GUI acts as a central control center for your backups.
- Create a Project : Click the + New button. Enter your Project Name (e.g., "Production") and Connection URI.
- Run a Backup : Select your project from the dropdown and click START BACKUP .
- Logs : Real-time logs will appear in the terminal window at the bottom.
- Settings : Click the ⚙️ (Gear Icon) to configure retention rules (e.g., "Max 5 backups").
- Edit Configs : Select a project and click the Edit (Pencil Icon) to update passwords or URIs.
Note: The GUI saves your configurations as
.envfiles in theenvs/folder and your preferences insettings.json.
For scheduled tasks (Cron) or CI/CD pipelines, use the CLI engine.
Use backup_engine.exe located in your extracted folder.
# Run a backup for the 'production' environment (looks for .production.env)
.\backup_engine.exe --env .production.env --non-interactive
# Create a permanent backup that won't be deleted
.\backup_engine.exe --env .production.env --non-interactive --permanent
python backup.py --env .production.env --non-interactive
To ensure stability during large backups, use the Transaction Pooler connection string.
- Go to your Supabase Project Dashboard.
- Navigate to Settings > Database .
- Copy the URI (Mode: Transaction) and paste it into the tool.
- Format:
postgresql://postgres:[PASSWORD]@[HOST]:6543/postgres?pgbouncer=true
- Format:
The tool stores credentials in envs/. The file name determines the backup prefix.
envs/.production.env→ Backup file:production_backup_2024...zip
Managed via the GUI Settings menu, but can be edited manually:
{
"max_backups": 5, // Keep last 5 files per project
"retention_days": 30 // Delete files older than 30 days
}
You can run this tool entirely in the cloud using GitHub Actions.
- Set Secrets in your Repo (Settings > Secrets > Actions):
PROD_DB_URIZIP_PASSWORD
- Add the Workflow : Uncomment the schedule block in
.github/workflows/backup.ymlto enable daily runs.
The workflow will spin up a runner, inject credentials, perform the backup, and commit the encrypted zip back to your repository.
Since backups are modular, you can restore the entire database or specific parts.
- Unzip the Archive : Important: Use 7-Zip or a similar tool (see Prerequisites) to handle the encryption.
# Example using command line unzip (if installed) or 7z.exe
7z x production_backup_2024-01-01.zip -orestore_folder
# You will be prompted for your ZIP_PASSWORD
- Run Restoration Commands :
Use the Supabase CLI or
psqlto restore:
# 1. Restore Roles (Caution: Overwrites permissions)
supabase db execute --db-url "$SUPABASE_DB_URI" -f restore_folder/roles.sql
# 2. Restore Schema (Tables, Views, Functions)
supabase db execute --db-url "$SUPABASE_DB_URI" -f restore_folder/schema.sql
# 3. Restore Data (Rows)
supabase db execute --db-url "$SUPABASE_DB_URI" -f restore_folder/data.sql
- Cloud Storage Integration : Direct upload to AWS S3, Cloudflare R2, or Google Cloud Storage.
- Notification Webhooks : Slack/Discord alerts on backup success/failure.
- One-Click Restore : A
restore.exeutility to automate the import process.
This project is licensed under the MIT License.

