This guide walks you through setting up your Supabase project, including database creation, SQL migrations, and storage configuration.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/aluxey/E-Commerce/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Supabase account
- Access to the SQL Editor in your Supabase dashboard
- The SQL files from the
Database/directory
Create a New Project
Create Supabase Project
- Go to Supabase Dashboard
- Click New Project
- Choose your organization
- Enter project details:
- Name:
sabbels-handmade(or your preferred name) - Database Password: Choose a strong password
- Region: Select the closest region to your users
- Name:
- Click Create new project
Save your database password securely. You’ll need it for direct database connections.
Run Database Migrations
Execute the SQL scripts in the following order to set up your database schema.Run Database Structure
- Click New Query
- Copy the contents of
Database/BDD_struct.sql - Paste into the SQL Editor
- Click Run
categories- Product categoriescolors- Available colors for itemsitems- Main product tableitem_variants- Size/color variants with stockitem_images- Product image galleryitem_colors- Available colors per itemitem_ratings- Customer reviewsorders- Order recordsorder_items- Order line itemspayments- Payment trackingusers- Customer accountscustomer_photos- Customer photo wallstripe_events- Webhook event tracking
Apply Row Level Security
- Create a new query
- Copy the contents of
Database/RLS.sql - Paste and click Run
- Public read access for products, colors, and categories
- Admin-only write access for products
- User-specific access to orders
- Storage policies for product images
Seed Initial Data (Optional)
If you have a
Database/SEED.sql file:- Create a new query
- Copy the contents of
Database/SEED.sql - Paste and click Run
- Initial categories
- Color palette
- Sample products (if included)
Configure Storage
Set up storage buckets for product images and customer photos.Create Storage Bucket
- Go to Storage in the Supabase dashboard
- Click New bucket
- Configure the bucket:
- Name:
product-images - Public bucket: ✓ Enabled
- File size limit: 10 MB
- Allowed MIME types:
image/*
- Name:
- Click Create bucket
Get API Credentials
You’ll need these values for your environment variables.Find Project URL
- Go to Project Settings > API
- Copy the Project URL
https://abcdefghijklm.supabase.coCreate Admin User
Create your first admin account to access the admin panel.Sign Up Through Your App
- Deploy or run your application locally
- Navigate to the sign-up page
- Create an account with your email
Reset Database (Development)
If you need to reset your database during development:Next Steps
Now that Supabase is configured:- Configure Stripe for payments
- Set up Resend for order emails
- Configure environment variables
Troubleshooting
”relation already exists” Error
If you see this error when running migrations:- Check if the table already exists
- Drop the table if needed:
DROP TABLE IF EXISTS table_name CASCADE; - Re-run the migration
RLS Policies Not Working
If users can’t access data:- Verify RLS is enabled: Go to Database > Tables > Check RLS enabled
- Check policies in Authentication > Policies
- Ensure the
is_admin()function exists
Storage Upload Fails
If image uploads fail:- Verify bucket exists and is public
- Check storage policies in Storage > Policies
- Verify file size is under 10MB
- Ensure MIME type is
image/*