- Go to supabase.com
- Create a new account or sign in
- Create a new project
- Choose a name, password, and region
- Wait for the project to be created
From your Supabase project dashboard:
- Go to Settings > API
- Copy the following values:
- Project URL
- Anon (public) key
- Service role (secret) key
Add these to your .env file:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key- Go to your Supabase project dashboard
- Navigate to SQL Editor
- Copy and paste the contents of
supabase/migrations/001_initial_schema.sql - Run the SQL script to create all tables and policies
The migration is designed to be drop-in compatible. Most of your existing code should work with minimal changes:
- Replace
import { prisma } from '@/lib/prisma'withimport { db } from '@/lib/database' - Replace Prisma queries with the equivalent db methods
- Update authentication to use Supabase Auth (optional)
Supabase provides built-in authentication. If you want to use it:
- Enable authentication providers in Supabase Dashboard > Authentication > Providers
- Update your auth logic to use Supabase Auth
- Implement Row Level Security policies for better security
- Start your development server:
npm run dev - Test all CRUD operations
- Verify security features work correctly
- Test contest functionality
Once everything is working:
- Update your production environment variables
- Deploy to your hosting platform (Vercel, Netlify, etc.)
- Built-in authentication and authorization
- Real-time subscriptions
- Row Level Security
- Auto-generated APIs
- Built-in storage for files
- Edge functions
- Better scalability
- Managed PostgreSQL database
const contests = await prisma.contest.findMany()const contests = await db.contests.findMany()The database adapter handles the conversion between Supabase and your existing code structure.