π Production Deployment Guide for Vercel
This guide will help you deploy your Poll Application to Vercel with proper production configuration.
π Pre-Deployment Checklist
π§ Step 1: Environment Variables Setup
Get Your Supabase Credentials
- Visit Supabase Dashboard: https://app.supabase.com/project/lymdzzecuwprowhuvnku/settings/api
- Collect these values:
- Project URL:
https://lymdzzecuwprowhuvnku.supabase.co
- Anon Key: Copy the
anon public key
- Service Role Key: Copy the
service_role key (keep this secret!)
Generate NextAuth Secret
# Generate a secure random secret (32+ characters)
openssl rand -base64 32
Or use an online generator: https://generate-secret.vercel.app/32
π Step 2: Vercel Deployment
Option A: One-Click Deploy (Recommended)

Option B: Manual Deployment
- Connect Repository:
- Go to Vercel Dashboard
- Click βAdd Newβ β βProjectβ
- Import your GitHub repository:
amitesh-maurya/poll-application
- Configure Build Settings:
- Framework Preset: Next.js
- Build Command:
npm run build (default)
- Output Directory:
.next (default)
- Install Command:
npm install (default)
βοΈ Step 3: Environment Variables Configuration
In your Vercel project settings, add these environment variables:
Required Variables
| Variable |
Value |
Description |
NEXTAUTH_SECRET |
your-generated-32-char-secret |
NextAuth.js encryption secret |
NEXT_PUBLIC_SUPABASE_URL |
https://lymdzzecuwprowhuvnku.supabase.co |
Supabase project URL |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
your-supabase-anon-key |
Supabase anonymous key |
SUPABASE_SERVICE_ROLE_KEY |
your-supabase-service-key |
Supabase service role key |
Production-Specific Variables
| Variable |
Value |
Description |
ALLOW_UNCONFIRMED_EMAIL |
false |
Require email confirmation |
NODE_ENV |
production |
Environment mode |
NEXT_PUBLIC_SITE_URL |
https://your-app.vercel.app |
Your deployed URL |
How to Add Variables in Vercel:
- Go to your project dashboard
- Click Settings tab
- Click Environment Variables in sidebar
- Add each variable with these settings:
- Environment: All (Production, Preview, Development)
- Type: Plain Text
- Value: Your actual values
ποΈ Step 4: Database Setup
Apply Database Schema
- Open Supabase SQL Editor: https://app.supabase.com/project/lymdzzecuwprowhuvnku/sql/new
- Copy and run the schema from
database-schema.sql:
-- Run the complete schema from database-schema.sql
-- This creates all necessary tables, indexes, and security policies
Verify Database Setup
Check that these tables exist:
π Step 5: Authentication Configuration
Supabase Auth Settings
- Go to Authentication Settings: https://app.supabase.com/project/lymdzzecuwprowhuvnku/auth/settings
- Configure Site URL:
- Add your Vercel URL:
https://your-app.vercel.app
- Add redirect URLs:
https://your-app.vercel.app/auth/**
Email Templates (Optional)
Customize email templates in Supabase for:
- Welcome emails
- Password reset
- Email confirmation
π Step 6: Deploy
- Trigger Deployment:
- Push code to your main branch, or
- Click βDeployβ in Vercel dashboard
- Monitor Build:
- Watch the build logs in Vercel
- Ensure no errors during build process
- Test Deployment:
- Visit your deployed URL
- Test signup/signin functionality
- Create a test poll
- Verify voting works
β
Step 7: Post-Deployment Verification
Production Checklist
π Troubleshooting
Common Issues
- Build Failures:
# Check for TypeScript errors
npm run type-check
# Check for linting issues
npm run lint
- Authentication Issues:
- Verify
NEXTAUTH_SECRET is set and 32+ characters
- Check
NEXTAUTH_URL matches your deployed URL
- Confirm Supabase auth settings allow your domain
- Database Connection Issues:
- Verify Supabase keys are correct
- Check RLS policies are properly configured
- Ensure database schema is applied
- Environment Variable Issues:
- Check all required variables are set
- Verify no typos in variable names
- Ensure values donβt have extra spaces
Debug Mode
For debugging in production, temporarily set:
DEBUG_LOGGING=true
- Check Vercel function logs
π― Production Best Practices
Security
Monitoring
π Updates and Maintenance
Regular Tasks
Deployment Process
- Test changes locally
- Push to feature branch
- Test on Vercel preview deployment
- Merge to main branch for production
π Need Help?
- Vercel Documentation: https://vercel.com/docs
- Supabase Documentation: https://supabase.com/docs
- NextAuth.js Documentation: https://next-auth.js.org
- GitHub Issues: https://github.com/amitesh-maurya/poll-application/issues
π Congratulations! Your Poll Application is now running in production on Vercel!