# Enterprise Supabase Setup Guide

This guide explains how to enable the optional real-auth mode in the Enterprise edition using the Supabase free tier.

## Why this is optional
The platform already works in static demo mode.
Supabase is only needed if you want stronger learner identity than browser-only storage.

## Step 1 — Create a free Supabase project
1. Go to `https://supabase.com`
2. Create a new project
3. Wait for provisioning

## Step 2 — Get project credentials
From the Supabase dashboard, copy:
- Project URL
- Anon key

## Step 3 — Configure the platform
Edit:

```text
assets/supabase-config.js
```

Set:
```js
window.HMGSupabaseConfig = {
  enabled: true,
  url: "https://YOUR-PROJECT.supabase.co",
  anonKey: "YOUR_SUPABASE_ANON_KEY",
  siteName: "HMG SQL Studio Ultimate",
  redirectTo: "https://your-live-domain/dashboard.html"
};
```

## Step 4 — Local testing redirect
For local testing you can use:

```text
http://localhost:8000/ultimate/dashboard.html
```

## Step 5 — Optional profile table
Run:

```text
supabase-schema.sql
```

in the Supabase SQL editor if you want a basic profile table.

## Step 6 — Test
1. open `auth.html`
2. sign up
3. log in
4. confirm redirect to `dashboard.html`
5. confirm logout works

## Important note
Supabase mode is still free-tier and still avoids paid AI API cost.
