# Quick Start - Data Migration

## Your saved songs and profiles are currently in localStorage. Here's how to migrate them to the backend for multi-device sync

### Step 1: Start the Backend (Already Started)

The backend server is now running at `http://localhost:5000`

### Step 2: Automatic Migration

When you refresh your frontend app, you'll see a migration dialog automatically if:

- You have existing songs/profiles in localStorage
- Backend mode is enabled in Settings
- You haven't migrated yet

Click **"Yes, Migrate Now"** to copy all your data to the backend.

### Step 3: Verify Migration

After migration completes:

1. Go to Database page - you should see all your songs
2. Go to Profile page - you should see all your profiles
3. Go to Planning - you should see all your worship plans

### Manual Migration (Alternative)

If the automatic dialog doesn't appear, you can migrate manually:

1. Open browser console (F12)
2. Run:

```javascript
import('./migration.js').then(m => m.migrateLocalStorageToBackend()).then(console.log)
```

### What Gets Migrated

- ✅ All songs with lyrics and chords
- ✅ All profiles with settings
- ✅ All worship plans with song lineups
- ✅ Profile-song associations
- ✅ Custom song keys per profile

### After Migration

Your data is now:

- **Synced** across all devices
- **Backed up** in `backend/data.json`
- **Real-time** updates via WebSocket

Local storage is kept as backup but backend is now the source of truth.

### Troubleshooting

**Migration dialog doesn't show:**

- Make sure Settings → Access Mode is set to "Online"
- Check that backend is running: `http://localhost:5000/api/songs`

**Migration fails:**

- Ensure backend is running
- Check console for errors
- Verify firewall isn't blocking port 5000

**Want to re-migrate:**

- Clear `localStorage.removeItem("data_migrated")`
- Refresh the page
