Codely has been migrated from a Prisma + Socket.io architecture to a Supabase-first architecture optimized for Vercel serverless deployment.
- Database: Migrated from Prisma ORM to Supabase PostgreSQL
- Real-time: Replaced Socket.io with Supabase Realtime
- Server: Removed custom Node.js server for Vercel serverless compatibility
- API Routes: Converted to Vercel Edge Functions
- Vercel Account
- Supabase Account
- Node.js 18+ and npm
- Go to Supabase Dashboard
- Click "New Project"
- Choose your organization and set project details
- Wait for the project to be created
-
Install Supabase CLI:
npm install -g supabase
-
Login to Supabase:
supabase login
-
Link your project:
supabase link --project-ref YOUR_PROJECT_REF
-
Run the migrations:
supabase db push
Or manually run the SQL files in your Supabase SQL editor:
supabase/migrations/001_initial_schema.sqlsupabase/migrations/002_rls_policies.sql
- In Supabase Dashboard, go to Authentication > Settings
- Configure your site URL (e.g.,
https://your-app.vercel.app) - Add redirect URLs:
https://your-app.vercel.app/auth/callbackhttp://localhost:3000/auth/callback(for development)
- Go to Database > Replication
- Enable realtime for these tables:
sessionssession_participantsoperations
Set these environment variables in your Vercel project:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_keyYou can find these values in your Supabase project settings under API.
-
Install Vercel CLI:
npm install -g vercel
-
Deploy:
vercel
- Push your code to GitHub
- Connect your repository to Vercel
- Vercel will automatically deploy on every push
- In Vercel Dashboard, go to your project settings
- Add your custom domain
- Update Supabase auth settings with your new domain
Create a .env.local file:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_keynpm installnpm run devThe application will be available at http://localhost:3000.
- No custom server required
- Automatic scaling with Vercel
- Edge function support for global performance
- Supabase Realtime for collaborative editing
- WebSocket connections managed by Supabase
- Automatic reconnection and presence tracking
- Direct PostgreSQL access through Supabase
- Row Level Security (RLS) for data protection
- Real-time subscriptions for live updates
- Pay-per-use serverless model
- No server maintenance costs
- Automatic scaling based on demand
- Enable Vercel Analytics in your project dashboard
- Monitor performance and usage metrics
- Use Supabase Dashboard for database monitoring
- Check real-time connections and performance
- Errors are automatically captured in Vercel logs
- Use Vercel's built-in error tracking
-
Environment Variables Not Loading
- Ensure variables are set in Vercel dashboard
- Redeploy after adding new variables
-
Database Connection Issues
- Verify Supabase URL and keys
- Check RLS policies are correctly configured
-
Real-time Not Working
- Ensure realtime is enabled for required tables
- Check browser console for WebSocket errors
-
Authentication Issues
- Verify redirect URLs in Supabase auth settings
- Check that site URL matches your deployment URL
For additional support:
- Supabase project created
- Database migrations applied
- Authentication configured
- Realtime enabled
- Environment variables set in Vercel
- Application deployed to Vercel
- Custom domain configured (if applicable)
- Testing completed on production environment