# Supabase Production Setup (No Docker)

This guide shows how to use Supabase production instance (no local Docker required).

## Quick Start

### Run Flutter with Supabase

```bash
cd old
./scripts/run-flutter-supabase.sh
```

This script:
1. Reads `env.json` for Supabase credentials
2. Extracts `SUPABASE_URL` and `SUPABASE_ANON_KEY`
3. Runs Flutter with `--dart-define` flags

### Manual Run

If you prefer to run manually:

```bash
flutter run -d chrome \
  --dart-define=SUPABASE_URL="https://yeqdxdocspsuexamljen.supabase.co" \
  --dart-define=SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
```

## Configuration

Your Supabase credentials are stored in `env.json`:

```json
{
  "SUPABASE_URL": "https://yeqdxdocspsuexamljen.supabase.co",
  "SUPABASE_ANON_KEY": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
```

## How It Works

1. **Script reads env.json** → Extracts Supabase credentials
2. **Flutter receives credentials** → Via `--dart-define` flags
3. **App initializes Supabase** → Uses `String.fromEnvironment()` to read credentials
4. **Services use Supabase** → All data operations go through Supabase client

## Troubleshooting

### "Missing SUPABASE_URL or SUPABASE_ANON_KEY"

**Solution**: Make sure you're running with the script:
```bash
./scripts/run-flutter-supabase.sh
```

Or manually pass the flags:
```bash
flutter run -d chrome \
  --dart-define=SUPABASE_URL="<your-url>" \
  --dart-define=SUPABASE_ANON_KEY="<your-key>"
```

### Script Can't Read env.json

Make sure:
1. `env.json` exists in the `old/` directory
2. File contains valid JSON
3. Has `SUPABASE_URL` and `SUPABASE_ANON_KEY` keys

### Supabase Connection Errors

1. **Check your Supabase project is active:**
   - Go to https://supabase.com/dashboard
   - Verify your project is running

2. **Verify credentials:**
   - Check `env.json` has correct values
   - Make sure anon key hasn't been rotated

3. **Check network:**
   - Ensure you can access `https://yeqdxdocspsuexamljen.supabase.co`

## Database Access

Your Supabase project has a PostgreSQL database. You can:

1. **Access via Supabase Dashboard:**
   - Go to https://supabase.com/dashboard
   - Select your project
   - Use SQL Editor or Table Editor

2. **Direct PostgreSQL connection:**
   - Connection string available in Supabase Dashboard → Settings → Database
   - Use with psql or any PostgreSQL client

## Next Steps

- ✅ Supabase is configured and ready
- ✅ Run `./scripts/run-flutter-supabase.sh` to start the app
- ✅ App will connect to your production Supabase instance

No Docker needed! 🎉

