Prerequisites
Before deploying to Vercel, ensure you have:- Completed Supabase Setup
- Your Supabase API keys ready
- Source code in a GitHub repository
- Gathered all environment variables
Connecting Your Repository
Sign in to Vercel
Go to vercel.com and sign in with GitHub
Import project
- Click “Add New…” → “Project”
- Select your GitHub repository from the list
- If not listed, click “Adjust GitHub App Permissions” to grant access
Configure project
Vercel will auto-detect Next.js. Verify the settings:
- Framework Preset: Next.js
- Root Directory:
./(or adjust if your app is in a subdirectory) - Build Command:
next build(auto-detected) - Output Directory:
.next(auto-detected) - Install Command:
npm install(orpnpm installif using pnpm)
Configuring Build Settings
Galey Cloud’snext.config.mjs includes specific configuration:
next.config.mjs
unoptimized: true disables Next.js image optimization. This is set because images are stored in Vercel Blob and served via CDN. If you need image optimization, consider using Next.js Image Optimization API or a third-party service.Adjusting Build Settings (Optional)
If you need to customize build settings:- In your Vercel project dashboard, go to Settings → General
- Scroll to Build & Development Settings
- Adjust as needed:
- Framework Preset: Next.js
- Build Command:
next build - Output Directory:
.next - Install Command: Use default or specify
pnpm install
Setting Up Vercel Blob Storage
Galey Cloud uses Vercel Blob to store uploaded photos.Enable Blob storage
- In your Vercel project dashboard, go to Storage
- Click “Create Database” or “Connect Store”
- Select “Blob”
- Choose a store name (e.g., “galey-photos”)
- Click “Create”
Connect to project
- After creation, click “Connect to Project”
- Select your Galey Cloud project
- Vercel will automatically add the required environment variables:
BLOB_READ_WRITE_TOKEN
The environment variable will be available to your project immediately.
How Blob Storage Works
Galey Cloud uses Vercel Blob in two API routes: Upload Photos (app/api/photos/upload/route.ts):
app/api/photos/delete/route.ts):
Photos are stored with
access: 'public', meaning URLs are publicly accessible without authentication. The blob URL is stored in Supabase, and RLS policies ensure users can only access their own photo metadata.Environment Variables Setup
Navigate to environment variables
In your Vercel project dashboard, go to Settings → Environment Variables
Add Supabase variables
Add the following variables from your Supabase project:
| Variable Name | Value | Environment |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL | Your Supabase project URL | Production, Preview, Development |
NEXT_PUBLIC_SUPABASE_ANON_KEY | Your Supabase anon key | Production, Preview, Development |
Select all three environments (Production, Preview, Development) to ensure the variables are available in all deployment contexts.
Add development redirect URL (optional)
If you need a custom redirect URL for development:
| Variable Name | Value | Environment |
|---|---|---|
NEXT_PUBLIC_DEV_SUPABASE_REDIRECT_URL | http://localhost:3000/auth/callback | Development only |
Deploy Your Application
Trigger deployment
Click “Deploy” to start your first deploymentVercel will:
- Clone your repository
- Install dependencies
- Run
next build - Deploy to the edge network
Monitor build
Watch the build logs in real-time. The deployment typically takes 1-3 minutes.Common build output:
Domain Configuration
Customize your deployment with a custom domain:Configure DNS
Vercel will provide DNS records to add to your domain registrar:For apex domains (example.com):For subdomains (galey.example.com):
Update Supabase redirect URLs
After adding your custom domain:
- Go to your Supabase project → Authentication → URL Configuration
- Add your custom domain to Redirect URLs:
- Update Site URL to your custom domain
Automatic Deployments
Vercel automatically deploys:- Production: Every push to your
mainormasterbranch - Preview: Every push to other branches and pull requests
Deployment Workflow
Preview deployments are perfect for testing changes before merging to production. Each PR gets its own unique URL.
Disabling Auto-Deploy (Optional)
To require manual deployments:- Go to Settings → Git
- Under Deploy Hooks, you can configure when deployments trigger
- Disable “Auto-deploy” for specific branches if needed
Monitoring and Logs
Real-time Logs
Access runtime logs
- Go to your project dashboard
- Click “Runtime Logs” in the top navigation
- View real-time logs from your application
Analytics
Galey Cloud includes Vercel Analytics via@vercel/analytics/next (app/layout.tsx:3):
Enable Analytics
- Go to your project dashboard → Analytics
- Analytics are automatically enabled for all Vercel projects
- View page views, unique visitors, and performance metrics
Error Tracking
Monitor API route errors:- Check Runtime Logs for server-side errors
- Use browser DevTools console for client-side errors
- Consider integrating Sentry for advanced error tracking:
Deployment Best Practices
Testing Before Deployment
Fix TypeScript errors
Before production, fix all TypeScript errors and remove
ignoreBuildErrors: true from next.config.mjsEnvironment Management
- Use Development environment variables for local development
- Use Preview for staging/testing branches
- Use Production only for the main branch
Performance Optimization
- Monitor Web Vitals in Vercel Analytics
- Optimize large images before uploading
- Use Vercel Edge Network for global performance
- Consider enabling Vercel Edge Functions for latency-sensitive routes
Troubleshooting
Build fails with “Missing environment variables”
- Verify all required environment variables are set in Settings → Environment Variables
- Ensure variables are enabled for the correct environment (Production/Preview/Development)
- Redeploy after adding variables
”Invalid Supabase credentials” errors
- Double-check
NEXT_PUBLIC_SUPABASE_URLandNEXT_PUBLIC_SUPABASE_ANON_KEY - Ensure there are no extra spaces or quotes
- Verify Supabase project is active
Photo uploads fail
- Check that Vercel Blob is connected and
BLOB_READ_WRITE_TOKENis set - Monitor Runtime Logs for upload errors
- Verify file size limits (Vercel Blob free tier: 100MB per file)
Authentication redirects fail
- Update Supabase Redirect URLs to include your Vercel domain
- Check Site URL in Supabase matches your deployment URL
- Ensure cookies are enabled
Next Steps
Environment Variables
Reference for all environment variables
Deployment Overview
Return to deployment overview