Database Setup
Initialize and configure your PostgreSQL database
Overview
Supasheet includes pre-built migrations in /supabase/migrations/ that create all necessary schemas, tables, and functions. You just need to apply them.
Local Setup (Development)
Cloud Setup (Production)
Create Supabase Project
- Go to supabase.com/dashboard
- Click "New Project"
- Choose organization and region
- Set database password
- Wait for project creation (~2 minutes)
Link Project
npx supabase link --project-ref your-project-refGet project-ref from dashboard URL: https://supabase.com/dashboard/project/[project-ref]
What Gets Created
The migrations automatically create:
- Schemas:
supasheet,public - Core Tables: accounts, roles, permissions, meta tables
- Feature Tables: dashboards, charts, reports, audit logs
- Storage Buckets: public, personal
- Functions: Permission checks, audit triggers, meta generators
- RLS Policies: Row-level security on all tables
Schema Exposure (Required)
After applying migrations, you must expose the supasheet schema via the PostgREST API. The public schema is already exposed by default.
Edit Supabase Configuration
Add the supasheet schema to /supabase/config.toml:
[api]
schemas = ["public", "supasheet"]This exposes:
public- Your application tables (exposed by default)supasheet- All Supasheet internal tables including accounts, roles, permissions, dashboards, charts, and reports
Restart Supabase (Local)
For local development, restart Supabase to apply the configuration:
npx supabase stop
npx supabase startUpdate Cloud Configuration (Production)
For cloud/production, update via the Supabase Dashboard:
- Go to Project Settings → Data API
- Find Exposed schemas section
- Add
supasheetto the list - Save changes
Important: Without exposing the supasheet schema, Supasheet won't be able to access authentication, authorization, configuration, dashboards, charts, and reports. The application will not function correctly.
Adding Your Own Tables
Create new migrations for your application tables:
npx supabase migration new add_products_tableSee Quickstart for complete examples.
Next Steps
- Deployment - Deploy your application
- Environment Variables - Configure settings