Deployment Guide
This guide covers deploying TamborraData to production using Vercel, the recommended hosting platform for Next.js applications.TamborraData is designed for Vercel deployment and takes advantage of Edge Functions, automatic scaling, and global CDN distribution.
Deployment Overview
Why Vercel?
Zero Configuration
Automatic Next.js detection and optimal build settings
Global CDN
Instant page loads from the nearest edge location
Automatic HTTPS
SSL certificates provisioned automatically
Preview Deployments
Every PR gets a unique preview URL
Analytics Built-in
Web Vitals and performance monitoring included
Serverless Functions
API routes scale automatically
Prerequisites
Before deploying, ensure you have:Vercel Account
Sign up at vercel.com (free tier available).
Step 1: Prepare Your Repository
Verify Build Locally
Before deploying, test the production build locally:- ✅ All pages load correctly
- ✅ No TypeScript errors
- ✅ No ESLint warnings
- ✅ Data fetches successfully
- ✅ Images and assets load
Required Files
Ensure these files exist in your repository:Vercel automatically detects
pnpm if pnpm-lock.yaml is present.Step 2: Set Up Production Database
Create Production Supabase Project
Create new project
Go to supabase.com and create a new project:
- Name:
tamborradata-production - Region: Choose closest to your users
- Plan: Free tier or Pro (depending on traffic)
Import production data
Import your real data (or mock data for initial deployment):
- Use Table Editor to import CSVs
- Or run SQL INSERT statements
- Ensure
available_yearshas correct years
Step 3: Deploy to Vercel
Import Project
Connect GitHub
- Go to vercel.com/new
- Click Import Git Repository
- Select your GitHub repository
- Authorize Vercel to access the repo
Configure Project
Vercel auto-detects settings:
- Framework Preset: Next.js ✅
- Root Directory:
./(or/sourceif in monorepo) - Build Command:
pnpm build(auto-detected) - Output Directory:
.next(auto-detected) - Install Command:
pnpm install(auto-detected)
Add Environment Variables
Click Environment Variables and add:
Select which environments:
| Name | Value |
|---|---|
SUPABASE_URL | Your production Supabase URL |
SUPABASE_ANON_KEY | Your production anon key |
- ✅ Production (required)
- ✅ Preview (recommended)
- ⬜ Development (optional)
Success! Your site is live at
https://your-project.vercel.appStep 4: Configure Custom Domain
Add Domain to Vercel
Configure DNS
Vercel provides DNS records to add at your registrar:Option A: A Record (Recommended)Option B: CNAMEAdd records at your domain registrar (GoDaddy, Namecheap, Cloudflare, etc.).
Add www subdomain (optional)
To support
www.tamborradata.com:- Add
www.tamborradata.comin Vercel Domains - Add CNAME record:
The
next.config.ts redirect will automatically redirect www → non-www.Wait for propagation
DNS changes take 5-60 minutes to propagate.Check status in Vercel Domains tab:
- 🟡 Pending: DNS not propagated yet
- 🟢 Valid: Domain configured correctly
Step 5: Configure Production Settings
Vercel Project Settings
General Settings
General Settings
Project Name:
tamborradata (or your preferred name)Build & Development Settings:- Framework Preset:
Next.js - Build Command:
pnpm build(default) - Output Directory:
.next(default) - Install Command:
pnpm install(default) - Node Version:
18.x(or20.x)
Environment Variables
Environment Variables
Ensure these are set for Production:
Git Integration
Git Integration
Configure automatic deployments:Production Branch:
main (or master)- Commits to this branch deploy to production
- Every PR gets a unique preview URL
- Great for testing before merging
Domains
Domains
Production Domain:
tamborradata.comPreview Domains:- Branch previews:
branch-name.vercel.app - PR previews:
pr-123.vercel.app
Step 6: Enable Analytics
TamborraData includes Vercel Analytics and Speed Insights.Web Analytics
Speed Insights
Analytics are included in the Vercel Pro plan. Hobby (free) plan has limited analytics.
Deployment Workflow
Continuous Deployment
Every Git push triggers a new deployment:Deployment Types
Rollback
To rollback to a previous version:Monitoring & Logs
Real-time Logs
View logs in Vercel dashboard:- Go to Project > Deployments
- Click on a deployment
- View Build Logs and Function Logs
Log Types
Build Logs
Build Logs
Shows build process output:
- Dependency installation
- TypeScript compilation
- Next.js build
- Static page generation
Function Logs
Function Logs
Runtime logs from API routes:
- Request/response logs
- Errors and exceptions
- Console.log output
- Performance metrics
Edge Logs
Edge Logs
Logs from Edge Middleware:
- Redirects
- Rewrites
- Header modifications
Troubleshooting Deployment
Build Failures
TypeScript Errors
TypeScript Errors
Error:
Type error: ...Solution:Missing Dependencies
Missing Dependencies
Error:
Module not found: Can't resolve '...'Solution:Environment Variable Missing
Environment Variable Missing
Error: Database connection fails, blank pagesSolution:
- Check Vercel Project Settings > Environment Variables
- Ensure
SUPABASE_URLandSUPABASE_ANON_KEYare set - Variables must be set for Production environment
- Redeploy after adding variables
Build Timeout
Build Timeout
Error:
Build exceeded maximum durationSolutions:- Remove unused dependencies
- Optimize build process
- Upgrade to Vercel Pro (longer timeout)
Runtime Issues
API Routes Not Working
API Routes Not Working
Problem:
/api/* returns 404 or 500Solutions:- Check Function Logs for errors
- Verify Supabase credentials in environment variables
- Test API routes locally:
pnpm build && pnpm start - Check for CORS issues (not common with same-origin API)
Database Connection Errors
Database Connection Errors
Problem:
Error connecting to SupabaseSolutions:- Verify
SUPABASE_URLis correct - Check
SUPABASE_ANON_KEYis the anon key, not service_role - Ensure Supabase project is not paused (free tier)
- Check RLS policies allow read access
Slow Performance
Slow Performance
Problem: Pages load slowlySolutions:
- Check Speed Insights for specific metrics
- Optimize images (use Next.js Image component)
- Enable React Query caching (already configured)
- Consider upgrading Supabase plan if database is slow
Security Best Practices
Never commit secrets
- ❌ Don’t commit
.env.local - ❌ Don’t commit
SUPABASE_ANON_KEYin code - ✅ Use Vercel Environment Variables
Use anon key only
- ❌ Never use
service_rolekey in frontend - ✅ Only use
anonkey for client connections - ✅ RLS policies enforce data access rules
Review RLS policies
- ✅ Ensure all tables have RLS enabled
- ✅ Policies allow only necessary access
- ✅ Test with anonymous user access
Performance Optimization
Next.js Optimizations (Already Configured)
TamborraData already implements these optimizations:
- ✅ Server Components: Default rendering strategy
- ✅ React Query Caching: Reduces API calls
- ✅ Image Optimization: Next.js Image component
- ✅ Code Splitting: Automatic per-route
- ✅ Compression: gzip/brotli enabled
- ✅ Edge Runtime: API routes run on Edge
Additional Optimizations
-
Enable ISR (Incremental Static Regeneration)
-
Add Static Generation for stable pages
-
Optimize Supabase queries
- Use
select()to fetch only needed columns - Add indexes on frequently queried columns
- Enable connection pooling
- Use
Scaling Considerations
Traffic Handling
Vercel automatically scales:- Edge Network: Serves from 100+ global locations
- Serverless Functions: Scale to zero, scale to millions
- No configuration needed: Automatic load balancing
Database Scaling
For high traffic, consider:- Upgrade Supabase plan: More connections and better performance
- Enable connection pooling: Use Supabase’s pooler
- Add database indexes: Speed up queries
- Implement caching: React Query + CDN caching
Next Steps
Monitor Performance
Set up alerts and monitoring in Vercel
Custom Domain Setup
Configure your production domain
CI/CD Pipeline
Automate testing before deployment
Backup Strategy
Set up automated Supabase backups
Congratulations! Your TamborraData instance is now live in production.