{"id":42490346,"url":"https://github.com/slowfound/supabase-database-backup","last_synced_at":"2026-01-28T12:02:30.323Z","repository":{"id":270689831,"uuid":"911145518","full_name":"slowfound/supabase-database-backup","owner":"slowfound","description":"Repository for YouTube tutorial on how to backup a Supabase DB for free and then restore that backup","archived":false,"fork":false,"pushed_at":"2025-01-02T14:10:49.000Z","size":4,"stargazers_count":75,"open_issues_count":2,"forks_count":68,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-18T14:36:51.178Z","etag":null,"topics":["github-actions","postgresql","supabase"],"latest_commit_sha":null,"homepage":"https://www.youtube.com/playlist?list=PLotEOI0Sz3OwKlVq-baJBKrfpF9bGrGeV","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slowfound.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-02T10:48:35.000Z","updated_at":"2025-11-14T07:44:07.000Z","dependencies_parsed_at":"2025-01-02T12:37:11.082Z","dependency_job_id":"ed08cb6e-542a-4118-9238-0e45643bd532","html_url":"https://github.com/slowfound/supabase-database-backup","commit_stats":null,"previous_names":["sesto-dev/supabase-database-backup","slowfound/supabase-database-backup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/slowfound/supabase-database-backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slowfound%2Fsupabase-database-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slowfound%2Fsupabase-database-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slowfound%2Fsupabase-database-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slowfound%2Fsupabase-database-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slowfound","download_url":"https://codeload.github.com/slowfound/supabase-database-backup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slowfound%2Fsupabase-database-backup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28845103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T10:53:21.605Z","status":"ssl_error","status_checked_at":"2026-01-28T10:53:20.789Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","postgresql","supabase"],"created_at":"2026-01-28T12:02:29.471Z","updated_at":"2026-01-28T12:02:30.309Z","avatar_url":"https://github.com/slowfound.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Supabase Database Backup with GitHub Actions\n\nThis repository provides a seamless way to automate backups of your Supabase database using GitHub Actions. It creates daily backups of your database’s roles, schema, and data, and stores them in your repository. It also includes a mechanism to easily restore your database in case something goes wrong.\n\n---\n\n## Features\n\n- **Automatic Daily Backups:** Scheduled backups run every day at midnight.\n- **Role, Schema, and Data Separation:** Creates modular backup files for roles, schema, and data.\n- **Flexible Workflow Control:** Enable or disable backups with a simple environment variable.\n- **GitHub Action Integration:** Leverages free and reliable GitHub Actions for automation.\n- **Easy Database Restoration:** Clear steps to restore your database from backups.\n\n---\n\n## Getting Started\n\n### 1. **Setup Repository Variables**\n\nGo to your repository settings and navigate to **Actions \u003e Variables**. Add the following:\n\n- **Secrets:**\n\n  - `SUPABASE_DB_URL`: Your Supabase PostgreSQL connection string. Format:  \n    `postgresql://\u003cUSER\u003e:\u003cPASSWORD\u003e@\u003cHOST\u003e:5432/postgres`\n\n- **Variables:**\n  - `BACKUP_ENABLED`: Set to `true` to enable backups or `false` to disable them.\n\n---\n\n### 2. **How the Workflow Works**\n\nThe GitHub Actions workflow is triggered on:\n\n- Pushes or pull requests to the `main` or `dev` branches.\n- Manual dispatch via the GitHub interface.\n- A daily schedule at midnight.\n\nThe workflow performs the following steps:\n\n1. Checks if backups are enabled using the `BACKUP_ENABLED` variable.\n2. Runs the Supabase CLI to create three backup files:\n   - `roles.sql`: Contains roles and permissions.\n   - `schema.sql`: Contains the database structure.\n   - `data.sql`: Contains table data.\n3. Commits the backups to the repository using an auto-commit action.\n\n---\n\n### 3. **Restoring Your Database**\n\nTo restore your database:\n\n1. Install the [Supabase CLI](https://supabase.com/docs/guides/cli).\n2. Open a terminal and navigate to the folder containing your backup files.\n3. Run the following commands in order:\n\n```bash\nsupabase db execute --db-url \"\u003cSUPABASE_DB_URL\u003e\" -f roles.sql\nsupabase db execute --db-url \"\u003cSUPABASE_DB_URL\u003e\" -f schema.sql\nsupabase db execute --db-url \"\u003cSUPABASE_DB_URL\u003e\" -f data.sql\n```\n\nThis restores roles, schema, and data, bringing your database back to its backed-up state.\nWorkflow Toggle\n\nUse the BACKUP_ENABLED variable to control whether backups are executed:\n\n    Set to true to enable backups.\n    Set to false to skip backups without editing the workflow file.\n\n## Requirements\n\n    A Supabase project with a PostgreSQL database.\n    Supabase CLI installed for manual restoration.\n    A GitHub repository with Actions enabled.\n\n## Contributing\n\nContributions are welcome! If you have improvements or fixes, feel free to submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslowfound%2Fsupabase-database-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslowfound%2Fsupabase-database-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslowfound%2Fsupabase-database-backup/lists"}