SpinAI uses Supabase as its PostgreSQL backend. The setup process takes about ten minutes: create a project, copy two environment variables, and run three migration files in the SQL Editor. No Supabase CLI or local Docker environment is required — everything is done through the Supabase dashboard.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fmoraga01/SpinAI/llms.txt
Use this file to discover all available pages before exploring further.
Setup steps
Create a new Supabase project
Go to supabase.com and sign in or create a free account. Click New project, choose an organisation, give the project a name (e.g.
spinai), set a strong database password, and select the region closest to your team. Wait for provisioning to complete — it usually takes under two minutes.Copy your project credentials
In the project dashboard, navigate to Project Settings → API. You need two values:
- Project URL — looks like
https://<ref>.supabase.co - anon / public key — a long JWT string under Project API keys
Add credentials to .env.local
In the root of your SpinAI repository, create or open Restart the Next.js dev server after saving so the new environment variables are picked up.
.env.local and add the two Supabase variables alongside the auth secrets:Run the migrations in order
Open the SQL Editor in your Supabase project dashboard (left sidebar → SQL Editor → New query) and run each migration file in the order shown below. Copy the file contents, paste into the editor, and click Run.
-
supabase/migrations/20260702000000_esquema_inicial.sqlCreates themembers,assignments,templates, andassignment_logstables, adds indexes, enables Row Level Security, and attaches a permissive anon policy to each table. Also enables thepgcryptoextension used bygen_random_uuid(). -
supabase/migrations/20260702180000_agenda_key_points_a_jsonb.sqlConverts theagendaandkey_pointscolumns intemplatesfromtext[]tojsonb. The migration is idempotent — it checks the current column type before altering, so running it on a database where the columns are alreadyjsonbis safe. -
supabase/migrations/20260702190000_crear_news_items.sqlCreates thenews_itemstable with a unique constraint onurl(for upsert deduplication), apublished_at descindex, and its own RLS anon policy.
YYYYMMDDHHMMSS prefix that determines the correct application order. Never edit a migration file that has already been applied — add a new file instead.Verify the tables exist
In the Supabase dashboard, go to Table Editor (left sidebar). You should see five tables:
membersassignmentstemplatesassignment_logsnews_items
Adding the email column
Themembers table includes an email column in the initial migration, so no extra step is needed if you ran 20260702000000_esquema_inicial.sql from scratch. If you are working against an older database that predates that migration, add the column manually:
if not exists guard makes this safe to run regardless of the current schema state.
Supabase client initialisation
The Supabase client is a lazily initialised singleton inlib/supabase.ts. The same instance is reused across all server and client calls within a process lifetime:
NEXT_PUBLIC_ so they are available in browser bundles. This is intentional — the anon key is designed to be public; the real security boundary is the PIN gate and the permissive-but-RLS-enabled database policies.