Metadata-Version: 2.4
Name: supadump
Version: 1.0.0
Summary: Snapshot your entire Supabase project — schema, data, functions, templates, storage, secrets, auth, realtime, vault, branches, and more
License: MIT
Project-URL: Homepage, https://gitlab.com/HYPER12755/supadump
Project-URL: Repository, https://gitlab.com/HYPER12755/supadump
Keywords: supabase,backup,disaster-recovery,cloud-migration,database-snapshot,postgresql,edge-functions,infrastructure-as-code,data-portability,business-continuity
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Database
Classifier: Topic :: System :: Archiving
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.9
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://img.shields.io/badge/supadump-v1.0-%233FCF8E?style=flat-square&labelColor=%23181818" alt="version">
  <img src="https://img.shields.io/badge/python-3.9%2B-%233776AB?style=flat-square&labelColor=%23181818" alt="python">
  <img src="https://img.shields.io/badge/license-MIT-%23D9E06B?style=flat-square&labelColor=%23181818" alt="license">
  <img src="https://img.shields.io/badge/16%20modules-%2394EBDC?style=flat-square&labelColor=%23181818" alt="modules">
</p>

<h1 align="center">supadump</h1>
<p align="center"><strong>One command. Your entire Supabase project. On disk.</strong></p>
<p align="center">
  Schema · Data · Edge Functions · Email Templates · Storage · Secrets ·<br>
  Auth Providers · Roles & Grants · Realtime · Vault · Branches ·<br>
  Service Versions · Network & SSL · Metadata · Manifest
</p>

---

## Why supadump?

**Supabase has no built-in backup.** You can `pg_dump` the database, but that leaves functions, storage, auth config, templates, secrets, and a dozen other critical pieces stranded in the cloud. If your project goes down, gets corrupted, or you just need to migrate — you're stitching together half a dozen tools, scripts, and API calls.

**supadump changes that.** It's a single Python script that talks to the Supabase Management API and your local Supabase CLI to snapshot *every layer* of your project.

Think of it as `mysqldump`, but for all of Supabase.

---

## What it saves

| # | Module | What you get | Flag |
|---|--------|-------------|------|
| 1 | **Database Schema** | 117 tables, 648 functions, 88 triggers, 203 RLS policies, 32 cron jobs, indexes, extensions, enums, views, publications, event triggers, foreign wrappers | `--db` |
| 2 | **Table Data** | All rows via `pg_dump --data-only` | `--data` |
| 3 | **Edge Functions** | Raw TypeScript source of every function | `--functions` |
| 4 | **Email Templates** | HTML templates, subject overrides, SMTP config | `--templates` |
| 5 | **Storage** | Bucket metadata, folders, and every uploaded file | `--storage` |
| 6 | **Secrets & Keys** | Anon key, service role key, JWT secret | `--secrets` |
| 7 | **Auth Providers** | OAuth client IDs/secrets, rate limits, hooks, MFA config | `--auth-providers` |
| 8 | **Roles & Grants** | DB roles, table/function grants, default privileges | `--roles-grants` |
| 9 | **Realtime** | Publication tables | `--realtime` |
| 10 | **Vault Secrets** | Secret names & metadata (values redacted) | `--vault` |
| 11 | **Auth Schema** | `auth.*`, `storage.*`, `realtime.*` table structures | `--auth-schema` |
| 12 | **Service Versions** | Postgres, GoTrue, PostgREST, Realtime, Storage API, Edge Runtime | `--service-versions` |
| 13 | **Project Metadata** | Name, org, region, status | `--metadata` |
| 14 | **Network & SSL** | IP restrictions, SSL enforcement | `--network-ssl` |
| 15 | **Branches** | Preview branch list | `--branches` |
| 16 | **Manifest** | SHA256 checksums of every dumped file | `--manifest` |

---

## Quick start

```bash
# Install the Supabase CLI (https://supabase.com/docs/guides/cli)
# Link your project
supabase login
supabase link --project-ref your-ref

# Dump everything
supadump

# Dump specific pieces
supadump --db                          # schema only
supadump --functions --templates       # edge functions + email templates
supadump --all --output ./backup       # full snapshot to custom dir

# Verify remote vs local
supadump --verify
```

---

## Why you need this

**You deploy to production.** You have RLS policies, edge functions, email templates, and a dozen auth providers configured through the dashboard. If you lose access, how long would it take to reconstruct every piece?

**You migrate between projects.** You're moving from free tier to pro, or from one org to another. You need schema *and* functions *and* auth config *and* storage — all at once, atomically.

**You want version control for your infra.** Dump to `./backup`, commit to git, and pin every layer of your project to a point in time. `git diff` your Supabase config.

**You sleep better at night.** One script. One command. Everything on disk.

---

## Usage

```
supadump                               # snapshot everything
supadump --db                           # schema only (no data)
supadump --data                         # user data only (rows)
supadump --storage                      # bucket files only
supadump --functions                    # edge functions only
supadump --templates                    # email templates only
supadump --secrets                      # API keys & secrets
supadump --auth-providers               # OAuth configs
supadump --roles-grants                 # DB roles & grants
supadump --realtime                     # realtime publication
supadump --vault                        # vault secrets meta
supadump --metadata                     # project info
supadump --network-ssl                  # network + SSL
supadump --branches                     # preview branches
supadump --auth-schema                  # auth/storage/realtime table structures
supadump --service-versions             # GoTrue/PostgREST/etc versions
supadump --db --data                    # schema + data only
supadump --all --output ./backup        # full snapshot
supadump --verify                       # compare remote vs local
supadump --manifest                     # checksums only
```

---

## Requirements

- **Python 3.9+**
- **Supabase CLI** (`supabase`) — linked to your project via `supabase link`
- **Supabase access token** with `manage_projects` scope (set via `SUPABASE_ACCESS_TOKEN` or `supabase login`)
- **Docker** (optional) — required only for `--data` (table rows) and `--storage` (file downloads). Metadata-only operations work without it.

---

## Security

- Vault secret values are **never saved** — only names and metadata
- Secrets are written to `.env` files — **store them offline, encrypt them, never commit them**
- The script passes your access token via environment variable, never on the command line
- Review the manifest (`--manifest`) to verify file integrity after dumping

---

## Architecture

```
supadump
├── ──db            →  supabase/migrations/schema.sql
├── ──data          →  supabase/migrations/data.sql        (Docker)
├── ──functions     →  supabase/functions/{name}/index.ts
├── ──templates     →  supabase/templates/{name}.html
├── ──storage       →  supabase/.temp/storage/             (Docker)
├── ──secrets       →  supabase/secrets/secrets.env
├── ──auth-providers → supabase/secrets/auth_providers.json
├── ──roles-grants  →  supabase/migrations/roles_grants.sql
├── ──realtime      →  supabase/migrations/realtime_tables.sql
├── ──vault         →  supabase/secrets/vault_secrets.json
├── ──metadata      →  supabase/secrets/project_metadata.json
├── ──network-ssl   →  supabase/secrets/network_*.json
├── ──branches      →  supabase/secrets/branches.json
├── ──auth-schema   →  supabase/migrations/auth_schema.sql
├── ──service-versions → supabase/secrets/service_versions.json
├── ──verify        →  comparison table (stdout)
└── ──manifest      →  supabase/manifest.json
```

---

## Trending Topics

`backup and disaster recovery` `cloud data migration` `business continuity` `infrastructure backup` `database replication` `SaaS data protection` `project snapshot` `cloud infrastructure management` `data portability` `vendor lock-in prevention` `disaster recovery planning` `cyber resilience` `multi-cloud strategy` `database schema export` `edge function backup` `Supabase backup` `PostgreSQL dump` `infrastructure as code` `cloud migration tools` `data sovereignty`

---

## License

MIT
