Overview
Studley AI is optimized for deployment on Vercel, with built-in support for Vercel Blob storage, Analytics, and serverless functions.Prerequisites
Vercel Account
Vercel Account
Sign up for a free account at vercel.com
Git Repository
Git Repository
Push your code to:
- GitHub
- GitLab
- Bitbucket
Environment Variables Ready
Environment Variables Ready
Have all environment variables prepared
Quick Deploy
Import Project
- Go to Vercel Dashboard
- Click “Add New…” → “Project”
- Import your Git repository
- Vercel will auto-detect Next.js configuration
Configure Build Settings
Vercel should auto-detect:
- Framework Preset: Next.js
- Build Command:
next build - Output Directory:
.next - Install Command:
npm install
Configuration Details
Next.js Config
Studley AI uses the following Next.js configuration (next.config.mjs):
next.config.mjs
Build Optimization
Cache Configuration
Cache Configuration
The app disables Next.js cache for fresh builds:This ensures each deployment uses the latest code without stale cache issues.
Turbopack (Development)
Turbopack (Development)
Turbopack is configured for faster local development:
Server Actions
Server Actions
Body size limit is increased to 25MB for file uploads:
Vercel-Specific Features
Analytics
Studley AI includes Vercel Analytics:- Go to your project
- Settings → Analytics
- Enable “Vercel Analytics”
Vercel Blob Storage
Create Blob Store
- Go to your Vercel project
- Navigate to Storage tab
- Click “Create Database” → “Blob”
- Name it
studley-uploads
Connect to Project
- Click “Connect to Project”
- Select your Studley AI project
- Vercel automatically adds
BLOB_READ_WRITE_TOKENto environment variables
Environment Variables by Environment
- Production
- Preview
- Development
Set production-only variables:Select “Production” environment when adding.
Custom Domain
Build Scripts
Package.json scripts optimized for Vercel:package.json
- Build: Runs automatically on deploy
- Start: Used for production server
- Lint: Optional pre-build check
Deployment Workflow
Automatic Deployments
Manual Deploy
Deploy from CLI:Performance Optimization
Image Optimization
Next.js Image component is configured for optimal performance:Caching Headers
Static assets are cached aggressively:Monitoring and Logs
View Deployment Logs
- Go to Vercel Dashboard
- Select your project
- Click on a deployment
- View Build Logs or Function Logs
Runtime Logs
- Vercel Dashboard
- Vercel CLI
Real-time logs available in:
- Project → Deployments
- Click deployment
- Go to “Functions” tab
- Click on any function to see logs
Troubleshooting
Build fails with module errors
Build fails with module errors
Error:
Cannot find module '@/lib/...'Solutions:- Verify
tsconfig.jsonhas correct path mappings - Check for case-sensitive file name issues
- Clear build cache: redeploy from scratch
Environment variables not found
Environment variables not found
Error:
process.env.GROQ_API_KEY is undefinedSolutions:- Verify variables are added in Vercel Dashboard
- Check variable names match exactly (case-sensitive)
- Ensure variables are set for correct environment (Production/Preview)
- Redeploy after adding new variables
Database connection timeout
Database connection timeout
Error:
Connection timeout in function logsSolutions:- Use connection pooling (already configured)
- Verify
DATABASE_URLis correct - Check database allows connections from Vercel IPs
- For Supabase: Enable connection pooling in Supabase settings
413 Payload Too Large
413 Payload Too Large
Error: File upload fails with 413Solution: Already configured to 25MB:If still failing, check Vercel plan limits.
Build exceeds time limit
Build exceeds time limit
Error: Build timeout (10 minutes on Hobby plan)Solutions:
- Optimize dependencies: remove unused packages
- Use
npm ciinstead ofnpm install - Consider upgrading Vercel plan for faster builds
Vercel Plan Comparison
- Hobby (Free)
- Pro ($20/month)
- Enterprise
Limits:
- 100GB bandwidth/month
- 6,000 build minutes/month
- 100GB storage
- Serverless function: 10 second timeout
Next Steps
File Storage Setup
Configure Vercel Blob for uploads
Environment Variables
Configure all required variables
Custom Domain
Add your own domain
Database Setup
Set up and migrate your database