Overview
AniDojo is optimized for deployment on Vercel, the platform built by the creators of Next.js. This guide walks you through deploying your AniDojo application to production.Before deploying, ensure you have a Supabase project set up and your database migrations applied. See Running Database Migrations for details.
Prerequisites
- A GitHub, GitLab, or Bitbucket account with your AniDojo repository
- A Vercel account (sign up at vercel.com)
- A configured Supabase project with migrations applied
- All required environment variables ready
Deployment Steps
Connect Your Repository
- Go to vercel.com and sign in
- Click “Add New Project”
- Select “Import Git Repository”
- Choose your AniDojo repository from GitHub/GitLab/Bitbucket
- Click “Import”
Configure Project Settings
Vercel will automatically detect your Next.js project. Configure the following:Framework Preset: Next.js (auto-detected)Root Directory:
./ (or your project root)Build Command: npm run build (default)Output Directory: .next (default)Install Command: npm install (default)Add Environment Variables
In the Environment Variables section, add all required variables:See Environment Variables for a complete list of required variables.
Deploy
- Review your configuration
- Click “Deploy”
- Wait for the build to complete (typically 2-5 minutes)
- Once deployed, you’ll receive a production URL like
your-app.vercel.app
Custom Domain Setup
To use your own domain:Add Domain in Vercel
- Go to your project dashboard in Vercel
- Navigate to Settings → Domains
- Click “Add Domain”
- Enter your domain name (e.g.,
anidojo.com)
Configure DNS
Vercel will provide DNS configuration instructions. Add the following records to your domain provider:Option A: CNAME Record (recommended for subdomains)Option B: A Record (for apex/root domains)
Automatic Deployments
Vercel automatically deploys your application when you push changes:- Production deployments: Triggered by pushes to your main/master branch
- Preview deployments: Created for every pull request and branch push
- Instant rollbacks: Revert to any previous deployment instantly
Every git push creates a unique deployment URL, making it easy to preview changes before merging to production.
Build Configuration
Turbopack Support
AniDojo uses Turbopack for faster builds. This is configured inpackage.json:
package.json
Image Optimization
Vercel automatically handles Next.js Image Optimization. The following remote patterns are configured innext.config.ts:
next.config.ts
Troubleshooting
Build Failures
“Module not found” errors:- Clear Vercel build cache: Settings → General → Clear Build Cache
- Ensure all dependencies are in
package.json - Check for case-sensitive import paths
- Verify environment variables are set in Vercel dashboard
- Redeploy after adding new environment variables
- Check variable names match exactly (including
NEXT_PUBLIC_prefix)
Runtime Errors
“Failed to fetch” or API errors:- Verify Supabase URL and keys are correct
- Check Supabase project is active and not paused
- Verify CORS settings in Supabase dashboard
- Ensure migrations have been run on your Supabase project
- Check RLS policies are properly configured
- Verify your Supabase anon key has correct permissions
- Confirm image domains are whitelisted in
next.config.ts - Check Supabase storage buckets are set to public
- Verify storage policies allow public read access
Performance Issues
Slow page loads:- Enable Edge Runtime for API routes where applicable
- Use Incremental Static Regeneration (ISR) for anime listing pages
- Optimize images using Next.js Image component
- Consider upgrading to Vercel Pro for reduced cold start times
- Implement proper caching strategies
- Use Edge Functions for latency-sensitive operations
Monitoring and Analytics
Vercel provides built-in monitoring:- Speed Insights: Track Core Web Vitals and performance metrics
- Web Analytics: Privacy-friendly analytics without cookies
- Log Drains: Stream logs to external services for advanced monitoring
- Error Tracking: Integrate with Sentry or similar services
Next Steps
Environment Variables
Learn about all required environment variables
Database Migrations
Set up and run database migrations