# Supabase Setup - nicklasfangerfisk/Smartbuy-backoffice GitHub Wiki
Supabase Setup
This page documents how to set up Supabase for the Smartbuy Backoffice project.
1. Create a Supabase Project
- Go to supabase.com and sign up or log in.
- Click "New Project" and follow the instructions.
- Note your project URL and anon/public API key (found in Project Settings > API).
2. Database Schema & Migrations
- All SQL migrations are in the
migrations/
folder of this repository. - You can apply migrations using the Supabase SQL editor or the Supabase CLI.
Applying Migrations via Supabase SQL Editor
- Open your Supabase project dashboard.
- Go to "SQL Editor".
- Copy the contents of each migration file (in order) from the
migrations/
folder and run them.
Applying Migrations via Supabase CLI
- Install the Supabase CLI.
- Authenticate and link your project.
- Run:
or apply each migration manually as needed.supabase db push
3. Regenerate Supabase Types
After changing the schema, regenerate the TypeScript types:
npx supabase gen types typescript --project-id <your-project-id> > components/supabase.types.ts
4. Environment Variables
Add your Supabase credentials to your environment:
VITE_SUPABASE_URL=your-supabase-url
VITE_SUPABASE_ANON_KEY=your-anon-key
5. Usage in the App
- The app uses
utils/supabaseClient.ts
to connect to Supabase. - All database operations use the generated types for type safety.
6. Useful Links
For more details, see the main README or ask in the project discussions.