Automatic Supabase backups with GitHub Actions
The Supabase Free plan doesn’t give you access to daily backups; those start on Pro. For free-tier projects, the official backup docs say to export your data regularly with the CLI and keep off-site copies. This guide sets that up as a GitHub Actions workflow that runs every week, for free, and dumps your database (and optionally your Storage files) into a bucket you own. Most of the setup is copying secrets.
Why free-tier projects need their own backups
A free project can feel low-stakes, but three things make backups more important there:
- Nobody else is backing it up. On Pro and above, Supabase takes daily backups of the database. On Free, if you do not export your data, no copy of it exists anywhere.
- Free projects get paused after 1 week of inactivity. A paused project can be restored from the dashboard for up to a year; after that it can no longer be restored in place. You can still download the backup and Storage files from the dashboard and migrate them to a new project, but by then you are doing recovery work on a deadline you did not choose. The paused-project guide covers the full timeline and how to resume. Recent snapshots in your own bucket give you another way to recover the data they contain.
- Free projects are often the ones nobody watches. Side projects, prototypes that turned into real products, a weekend tool a client now depends on. Nobody is on call for these, so the backup has to run on a schedule, not when someone remembers.
Set it up, step by step
You need a GitHub repository (make it private; the reason is below), a bucket you own on Cloudflare R2, AWS S3, or Backblaze B2, and your project’s Session Pooler connection string. The workflow uses the open-source backupdrill CLI (MIT, github.com/backupdrill/cli), which wraps pg_dump and writes a checksummed manifest next to the dump.
Step 1: Copy the workflow into your repo
Create .github/workflows/scheduled-backup.yml with the following content. The CLI repo has a daily version in examples/scheduled-backup.yml; on the Free plan, keep the weekly cron below.
# .github/workflows/scheduled-backup.yml
name: scheduled-backup
on:
schedule:
# Weekly, Sunday 03:00 UTC — the sane default on the Free plan (see the
# egress section). Runs can start late when GitHub Actions is under load.
- cron: "0 3 * * 0"
workflow_dispatch: {} # lets you trigger a backup by hand from the Actions tab
# Read-only checkout is all this job needs.
permissions:
contents: read
# Never let two backups overlap.
concurrency:
group: backupdrill-scheduled
cancel-in-progress: false
jobs:
backup:
runs-on: ubuntu-latest
steps:
# pg_dump's major version must be >= your Supabase Postgres version.
# Supabase projects run PG 15 or 17 — postgresql-client-17 covers both.
# Install it from the official PostgreSQL apt repo (PGDG); Ubuntu's
# default repo lags behind.
- name: Install postgresql-client-17 (PGDG)
run: |
sudo install -d /usr/share/postgresql-common/pgdg
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| sudo gpg --dearmor -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg] \
https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
| sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get install -y postgresql-client-17
# Point the CLI straight at the v17 binary so it can't pick up an older
# pg_dump that may already be on the runner's PATH.
- name: Tell backupdrill where pg_dump 17 lives
run: echo "BACKUPDRILL_PG_DUMP=/usr/lib/postgresql/17/bin/pg_dump" >> "$GITHUB_ENV"
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Run backupdrill
run: npx backupdrill backup
env:
# --- required ---
BACKUPDRILL_DATABASE_URL: ${{ secrets.BACKUPDRILL_DATABASE_URL }}
BACKUPDRILL_S3_BUCKET: ${{ secrets.BACKUPDRILL_S3_BUCKET }}
BACKUPDRILL_S3_ACCESS_KEY_ID: ${{ secrets.BACKUPDRILL_S3_ACCESS_KEY_ID }}
BACKUPDRILL_S3_SECRET_ACCESS_KEY: ${{ secrets.BACKUPDRILL_S3_SECRET_ACCESS_KEY }}
# --- optional: destination bucket details ---
BACKUPDRILL_S3_ENDPOINT: ${{ secrets.BACKUPDRILL_S3_ENDPOINT }}
BACKUPDRILL_S3_REGION: ${{ secrets.BACKUPDRILL_S3_REGION }}
BACKUPDRILL_PROJECT_NAME: ${{ secrets.BACKUPDRILL_PROJECT_NAME }}
# --- optional: also back up Supabase Storage files (set all four) ---
BACKUPDRILL_SUPABASE_STORAGE_ENDPOINT: ${{ secrets.BACKUPDRILL_SUPABASE_STORAGE_ENDPOINT }}
BACKUPDRILL_SUPABASE_STORAGE_REGION: ${{ secrets.BACKUPDRILL_SUPABASE_STORAGE_REGION }}
BACKUPDRILL_SUPABASE_STORAGE_ACCESS_KEY_ID: ${{ secrets.BACKUPDRILL_SUPABASE_STORAGE_ACCESS_KEY_ID }}
BACKUPDRILL_SUPABASE_STORAGE_SECRET_ACCESS_KEY: ${{ secrets.BACKUPDRILL_SUPABASE_STORAGE_SECRET_ACCESS_KEY }}Two details matter here. concurrency stops a slow run and the next scheduled run from backing up at the same time, which would double your egress. The PGDG install is there because pg_dump’s major version must be at least your Supabase Postgres version, and the runner’s default client can be older than your database.
Step 2: Get the Session Pooler connection string
In the Supabase dashboard, click the Connect button at the top of the page and pick Session pooler. Copy the URI and fill in your database password. The default postgres user in it works as-is. It owns your tables, so row-level security doesn’t block the dump. If you would rather use a read-only role, give it bypassrls and pg_read_all_data. Without bypassrls, pg_dump stops with an error on the first table that has row-level security enabled, so the job fails instead of producing a partial dump.
Step 3: Create the destination bucket
Any S3-compatible bucket works. The bucket setup guide shows where to click to create a bucket and a scoped access key pair on R2, S3, and B2. Use credentials scoped to this one bucket, not account-wide keys.
Step 4: Add the repository secrets
In your GitHub repo: Settings → Secrets and variables → Actions → New repository secret. Four are required:
BACKUPDRILL_DATABASE_URL: the Session Pooler string from step 2, password included.BACKUPDRILL_S3_BUCKET: the bucket name from step 3.BACKUPDRILL_S3_ACCESS_KEY_IDandBACKUPDRILL_S3_SECRET_ACCESS_KEY: the scoped credentials for that bucket.
The rest are optional. An unset secret resolves to an empty string, which the CLI treats as “not provided”, so you can leave them out. Set BACKUPDRILL_S3_ENDPOINT and BACKUPDRILL_S3_REGION for R2 or B2 (omit both for AWS S3; auto works as the R2 region). To include your Supabase Storage files in the same snapshot, set all four BACKUPDRILL_SUPABASE_STORAGE_* secrets with keys generated at Dashboard → Storage → Settings → S3 Access Keys. It’s worth doing, because a database restore alone does not bring files back.
Step 5: Run it once by hand, then check the bucket
Actions tab → scheduled-backup → Run workflow. When it goes green, look in the bucket: you should see a timestamped snapshot containing dump.pgcustom (plain pg_dump custom format that restores with stock pg_restore), RECOVERY.md with the restore steps, manifest.json with tables, estimated row counts, and sha256 checksums, auth.dump with your Auth users when the database role can read them, and a storage/ tree if you configured the Storage secrets. If the run fails, the cause is usually a mistyped pooler string or bucket credentials that cannot write to the bucket. The log says which.
Egress: the Free plan gives you 5 GB per month
Every backup streams your data out of Supabase, and that counts against the Free plan’s 5 GB/month egress allowance, the same allowance your app uses. Free-tier databases are capped at 500 MB, so even at that size, weekly backups move roughly 2 GB/month. Daily backups of the same 500 MB database would move roughly 15 GB/month, three times the allowance. On the Free plan, back up weekly and use workflow_dispatch for extra runs before migrations.
Going over is not a hard cutoff. Supabase notifies your billing email and applies a grace period; if usage stays over and nothing changes, Fair Use restrictions follow: projects can be paused, databases switched to read-only, and API requests answered with 402s. Restrictions lift when you upgrade or when the quota resets at the start of the next billing cycle. A used-up grace period does not renew, so a later overage can be restricted without one. Take the first notice seriously. For your own numbers, npx backupdrill estimate projects monthly egress from your actual database size, and the CLI docs cover the paid-plan egress math.
Two ways a DIY backup schedule stops without warning
- The 60-day rule in public repos. GitHub automatically disables scheduled workflows in a public repository after 60 days without repository activity, and a backup repo can easily go 60 days without a commit. Use a private repository: the rule does not apply there, and there’s no reason to make your backup setup public anyway.
- Nobody checks the Actions tab. A scheduled job that fails is easy to miss. Check the tab when you touch the repo, and have something outside GitHub expect the backup: the Healthchecks.io guide sets up an alert for a run that fails or never starts. Otherwise you may only find out the backup stopped months ago when you need it.
A green run doesn’t mean the backup restores
A green run means the job exited 0. It doesn’t mean the dump restores. In a bucket, a truncated dump or one taken with the wrong role looks the same as a good backup. The dump covers the public schema by default, so Supabase-managed schemas (auth, storage metadata) are not in it. To know the backup works, restore it somewhere disposable. The restore testing guide walks through the full manual drill, or run backupdrill drill locally. It pulls the latest snapshot from your bucket, restores it into a throwaway Docker Postgres, and verifies it against the manifest.
If you’d rather not maintain the cron job, the YAML file and the restore tests yourself, the hosted service runs this same engine on a schedule, with restore drills and email reports included.
FAQ
Does Supabase back up projects on the Free plan?
No. Automated daily backups start on the Pro plan; the Free plan does not include them. Supabase's own backup docs advise free-tier projects to export their data regularly with the CLI's db dump command and keep off-site backups. A scheduled GitHub Actions workflow does that for you.
How often should I back up a free-tier Supabase project?
Weekly. Every backup counts against the Free plan's 5 GB/month egress allowance, and free-tier databases are capped at 500 MB. Even at that size, weekly backups stay around 2 GB/month, which leaves most of the allowance for your app. Daily backups of a 500 MB database would move roughly 15 GB/month, three times the allowance. Keep the workflow_dispatch trigger so you can run an extra backup by hand before risky migrations.
What happens when a free-tier project gets paused?
Supabase pauses Free plan projects after 1 week of inactivity. A paused project can be restored from the dashboard for up to a year; after that it can no longer be restored in place, but you can still download its backup and Storage files from the dashboard and migrate them to a new project. Your own scheduled backups in a bucket you control give you another way to recover the data they contain.
Can I commit the database dump to the GitHub repo instead of a bucket?
You can. Supabase documents a DIY approach that runs db dump on a schedule and commits the output to a private repo. It works, with trade-offs: every dump stays in git history, so the repo keeps growing; anything sensitive in the data is very hard to purge from that history later; and restore tooling generally expects object storage. A bucket with lifecycle rules stays cheap and deletes old backups for you.
Sources
- Supabase docs — Database Backups
- Supabase — Pricing
- Supabase docs — Manage Egress usage
- Supabase docs — Billing FAQ (Fair Use Policy)
- Supabase docs — Project Pausing
- Supabase docs — Connecting to your database
- GitHub Docs — Events that trigger workflows
- PostgreSQL docs — pg_dump
Facts and prices last verified August 9, 2026 against the sources above. Written by the team behind BackupDrill.
Want the schedule, the failure alerts, and the restore drills without owning the workflow? Start free (the Free plan covers weekly backups for one project), or keep it DIY with the open-source CLI.