Skip to content

Setup: Supabase

Supabase stores two small tables: users (with a virtual_key column) and sandboxes. The user_sandboxes view joins them for admin queries.

Steps

1. Create a project

At https://supabase.com/dashboardNew Project. Pick a region close to your Vercel deployment. Save the database password.

2. Grab the env vars

In Project Settings → API:

  • Project URLSUPABASE_URL
  • service_role secretSUPABASE_SERVICE_ROLE_KEY

Cloud uses the service-role key to bypass row-level security from the Next.js app. Treat it like the root password — it never leaves the server and never ships to the browser.

3. Run the initial migration

Open SQL EditorNew query. Paste the contents of supabase/migrations/001_init.sql from your shmastra-cloud checkout. Click Run.

This creates:

  • The users and sandboxes tables.
  • The user_sandboxes view.
  • The indexes and triggers used by the sandbox-manager.

4. Verify

In Table Editor you should now see three objects: users, sandboxes, user_sandboxes. The tables are empty; they'll populate the first time someone signs in.

Where the variables go

Variable.env.localVercel
SUPABASE_URL
SUPABASE_SERVICE_ROLE_KEY

Next

Continue to WorkOS.

Released under the Apache-2.0 License.