This guide explains how to configure Supabase in the ignitionstack.pro project.
If you already have credentials:
# .env
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
SUPABASE_SERVICE_ROLE_KEY=your-service-role-keyGo to supabase.com
Click “Start your project”
Sign in (GitHub, Google, etc.)
Click “New Project”
Choose organization and region
Configure:
ignitionstack (or your preferred name)South America (Sao Paulo))Free (for development)Wait ~2 minutes to provision
In the project dashboard:
# Project URL
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
# anon (public) key - can be exposed on client
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
# service_role key - NEVER expose on client!
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Create/update .env file:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-keyImportant:
NEXT_PUBLIC_* are public variables (client-side)SUPABASE_SERVICE_ROLE_KEY is private (server-side only).env to Gitnpm install-- Create posts table
create table posts (
id uuid default gen_random_uuid() primary key,
created_at timestamp with time zone default timezone('utc'::text, now()) not null,
title text not null,
slug text unique not null,
content text,
published boolean default false,
author_id uuid references auth.users(id) on delete cascade
);
-- Create indexes
create index posts_slug_idx on posts(slug);
create index posts_author_id_idx on posts(author_id);
-- Enable Row Level Security
alter table posts enable row level security;
-- Policy: Anyone can read published posts
create policy "Published posts are public"
on posts for select
using (published = true);
-- Policy: Only author can update/delete their posts
create policy "Authors can manage their posts"
on posts for all
using (auth.uid() = author_id);The repository already ships with validated SQL that you can paste directly into the Supabase dashboard. You decide whether to run everything in a single shot or execute smaller slices table by table.
supabase/migrations/implementation-full/schema.sql and paste them into the editor.You can do the same for supabase/migrations/implementation-full/seed.sql (optional demo/admin data) and supabase/migrations/implementation-full/rollback.sql (tears everything down).
If you prefer to apply changes gradually or debug specific parts, use the split folders:
supabase/migrations/schema/ – ordered schema scriptssupabase/migrations/seed/ – ordered seed scriptssupabase/migrations/roolback/ – ordered rollback scriptsEach file starts with a numeric prefix (01_setup.sql, 02_profiles.sql, …). Run them sequentially inside the SQL Editor—highlight the file contents, paste, execute, then move to the next number. This mirrors Supabase’s migration order and lets you stop/re-run individual sections (e.g., only 33_ai_models.sql when adjusting AI catalogs).
Tips
implementation-full/seed.sql to load admin + AI data or cherry-pick files under supabase/migrations/seed/ (e.g., run 02_seed_admin_user.sql alone when you just need the admin account).implementation-full/rollback.sql) from the SQL Editor will drop triggers, policies, tables, and extensions in the correct order when you need a clean slate.# Install Supabase CLI
npm install -g supabase
# Login
supabase login
# Link project
supabase link --project-ref your-project-ref
# Create migration
supabase migration new create_posts_table
# Edit file in supabase/migrations/
# Then apply:
supabase db push
# Generate TypeScript types
npm run db:gennpx supabase gen types typescript --project-id <id> > src/types/database.types.tsThis eliminates all any type assertions and provides full type safety.
Checklist:
npm run db:gen)Solution: Verify you copied the correct key from the dashboard
Solution: Check if RLS policies are configured correctly
Solution: Ensure NEXT_PUBLIC_SUPABASE_* variables are in .env
Solution: Depois de executar SQL manualmente pelo dashboard, force o PostgREST a recarregar o schema executando:
NOTIFY pgrst, 'reload schema';Isso limpa o cache e faz as novas tabelas aparecerem imediatamente nas rotas REST.
Solution: Run npm run db:gen after creating/modifying tables