Environment Variables
| Variable | Description | Type | Source |
|---|---|---|---|
ADMIN_EMAIL | Email address for the admin user* | server safe | Your admin email |
ADMIN_PASSWORD | Initial password for the admin user* | server secret | Generate a secure password |
* Required variable
Option 1: Using Supabase Dashboard
The simplest way to create an admin user:
- Go to Supabase Dashboard
- Navigate to Authentication → Users
- Click "Add user"
- Enter the admin email and password
- Click "Create user"
- Note the user's UUID
Then update the user's role to admin in the profiles table:
-- Run in SQL Editor (Dashboard → SQL Editor)
UPDATE public.profiles
SET role = 'admin'
WHERE id = 'USER_UUID_HERE';Option 2: Using Seed Script
Use the provided seed script for automated setup:
First, add to your .env.local:
.env.local
# Admin User Seeding
ADMIN_EMAIL=admin@yourdomain.com
ADMIN_PASSWORD=your-secure-password-hereUse a Strong Password
Generate a strong password with at least 12 characters, including uppercase, lowercase, numbers, and symbols.
Then run the seed command:
npm run db:seed:adminOption 3: SQL Seed File
Add to your supabase/seed.sql file:
supabase/seed.sql
-- Note: This creates the user in auth.users
-- You'll need to use the Dashboard or a script for password setup
-- After the user exists, update their role:
-- UPDATE public.profiles SET role = 'admin' WHERE email = 'admin@yourdomain.com';Auth User Creation
Supabase doesn't allow creating auth users directly via SQL. Use the Dashboard or the Admin API (via service role key) to create the initial user.
Verify Admin Access
- Start your development server
- Log in with your admin credentials
- Navigate to
/adminor your admin route - Verify you have access to admin features
Troubleshooting
"Access denied" to admin routes
Check that the user's role is set to 'admin' in the profiles table and that RLS policies are configured correctly.
Profile not created
Ensure your database has a trigger that creates a profile when a new auth user is created. Check the migrations for the trigger definition.
Setup Complete!
Congratulations! You've completed all the setup modules. Your VibeCodeMax application is now fully configured with:
- • Supabase authentication and database
- • Payment processing (if enabled)
- • Email capabilities (if enabled)
- • File storage (if enabled)
- • Admin user management
