> ## Documentation Index
> Fetch the complete documentation index at: https://system.muzemus.online/llms.txt
> Use this file to discover all available pages before exploring further.

# Backups and recovery

> Database backup strategy and disaster recovery procedures

## Backup strategy

Neon manages backups automatically.

| Feature                | Details              |
| ---------------------- | -------------------- |
| Provider               | Neon managed backups |
| Frequency              | Daily                |
| Retention              | 7 days (free tier)   |
| Point-in-time recovery | Available            |

A backup that has never been restored is not evidence of recoverability. Verify restores periodically (see the verification checklist below).

### Manual backups

```bash theme={null}
# Create a backup
pg_dump $DATABASE_URL > backup_$(date +%Y%m%d).sql

# Restore from backup
psql $DATABASE_URL < backup_20260904.sql
```

## Recovery procedures

### Accidental data deletion

```mermaid theme={null}
flowchart TD
    A[Data deleted] --> B{Detected within 7 days?}
    B -->|Yes| C[Neon point-in-time restore]
    B -->|No| D[Restore from manual backup]
    C --> E[Create branch from point in time]
    E --> F[Verify data]
    F --> G[Promote branch]
```

### Migration failure

```mermaid theme={null}
flowchart TD
    A[Migration fails in production] --> B[Application will not start]
    B --> C[Check migration SQL]
    C --> D{Fixable?}
    D -->|Yes| E[Fix migration, deploy again]
    D -->|No| F[Redeploy previous version]
    E --> G[Verify application starts]
    F --> G
```

### Full database corruption

1. Suspend the application (Render dashboard)
2. Create a branch from the latest clean backup
3. Verify the branch holds the expected data
4. Promote the branch
5. Update `DATABASE_URL` in Render if the endpoint changed
6. Resume the application and run smoke tests

## Recovery time objectives

| Scenario                 | Expected RTO      | Method                     |
| ------------------------ | ----------------- | -------------------------- |
| Accidental data deletion | Under 30 minutes  | Neon point-in-time restore |
| Migration failure        | Under 15 minutes  | Fix or redeploy            |
| Database corruption      | Under 1 hour      | Branch restore from backup |
| Full Neon outage         | Dependent on Neon | Wait for provider recovery |

## Verification checklist

| Check                              | Frequency                              |
| ---------------------------------- | -------------------------------------- |
| Backup exists                      | Daily, via Neon dashboard              |
| Backup is restorable               | Periodically, restore to a test branch |
| Restored data matches expectations | Spot-check after each restore test     |

## What is not backed up

| Data                  | Notes                                                  |
| --------------------- | ------------------------------------------------------ |
| Environment variables | Stored in the Render dashboard; record them separately |
| Firebase config       | Stored in the Firebase console                         |
| R2 file storage       | Managed separately by Cloudflare                       |
