This guide explains how KanaDojo is deployed to Vercel and how the deployment pipeline works.
- Overview
- Deployment Process
- Environments
- Environment Variables
- Custom Domains
- Build Configuration
- Performance & Caching
- Troubleshooting
KanaDojo is deployed to Vercel, a platform optimized for Next.js applications. The deployment pipeline is fully automated through GitHub Actions and includes:
- Automatic deployments on push to
main - Preview deployments for pull requests
- Discord notifications for deployment status
- Edge caching for optimal performance
When code is pushed to the main branch:
- GitHub Actions triggers the deployment workflow
- Vercel receives the webhook and starts building
- Build Process runs:
- TypeScript compilation (
tsc --noEmit) - Next.js build (
next build) - Sitemap generation (
postbuildscript)
- TypeScript compilation (
- Deployment to production environment
- Notification sent to Discord (success or failure)
For each pull request:
- Vercel automatically creates a preview deployment
- Preview URL is added as a comment on the PR
- Preview builds run the same checks as production
- Preview deployments are deleted when PR is merged/closed
| Environment | Branch | URL | Purpose |
|---|---|---|---|
| Production | main |
kanadojo.com | Live application |
| Preview | PR branches | *.vercel.app |
Testing before merge |
| Development | Any branch | Local | Development |
- URL: https://kanadojo.com
- Region: Vercel's default (typicallyiad1 - Washington, D.C.)
- Framework: Next.js 15 with Turbopack
- Edge Functions: Enabled for API routes
| Variable | Description | Where to Get |
|---|---|---|
GOOGLE_TRANSLATE_API_KEY |
Google Cloud Translation API key | Google Cloud Console |
NEXT_PUBLIC_GA_ID |
Google Analytics measurement ID | Google Analytics |
NEXT_PUBLIC_POSTHOG_KEY |
PostHog API key | PostHog |
NEXT_PUBLIC_SUPABASE_URL |
Supabase project URL | Supabase |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Supabase anonymous key | Supabase |
| Variable | Description | Default |
|---|---|---|
DISCORD_WEBHOOK_URL |
Discord webhook for notifications | Not set |
SENTRY_DSN |
Sentry error tracking | Not set |
ANALYZE |
Bundle analysis | false |
- Go to Vercel Dashboard
- Navigate to Settings → Environment Variables
- Add variables for each environment (Production, Preview, Development)
- Redeploy to apply changes
KanaDojo uses the following custom domains:
| Domain | Type | Configuration |
|---|---|---|
kanadojo.com |
Production | A record pointing to Vercel |
www.kanadojo.com |
Redirect | CNAME to main domain |
- SSL/TLS: Automatically provisioned by Vercel
- HTTPS: Always enforced
- WWW: Redirects to apex domain
// next.config.ts
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
// Enable React strict mode
reactStrictMode: true,
// Enable turbopack in dev
experimental: {
turbo: {
resolveAlias: {
'@/*': './*',
},
},
},
// Image optimization
images: {
domains: ['kanadojo.com'],
formats: ['image/avif', 'image/webp'],
},
// Enable i18n
i18n: {
locales: ['en', 'es', 'ja'],
defaultLocale: 'en',
localeDetection: true,
},
};
export default nextConfig;# package.json scripts
{
"scripts": {
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"postbuild": "next-sitemap",
"analyze": "ANALYZE=true npm run build"
}
}After a successful build, Vercel produces:
- Serverless Functions: API routes (Edge runtime)
- Static Assets: JavaScript, CSS, images
- Edge Config: Internationalization routing
- Headers: Security and caching headers
| Resource Type | Cache-Control | S-MaxAge | Stale-While-Revalidate |
|---|---|---|---|
| Static Assets | public, max-age=31536000 | 31536000 | - |
| API Responses | varies | varies | varies |
| OG Images | public, max-age=86400 | 86400 | 604800 |
- CDN: Vercel's global edge network (35+ regions)
- Edge Functions: API routes run at edge for low latency
- ISR: Incremental Static Regeneration not enabled (uses SSR)
| Metric | Target | Actual |
|---|---|---|
| LCP | < 2.5s | ~1.2s |
| FID | < 100ms | ~45ms |
| CLS | < 0.1 | ~0.02 |
Common Causes:
-
TypeScript Errors
# Run locally to check npm run check -
Missing Environment Variables
- Check Vercel dashboard for missing vars
- Ensure they're set for correct environment
-
Dependency Issues
# Clear cache and reinstall rm -rf node_modules .next npm install npm run build
- Check Vercel Dashboard for status
- View build logs for errors
- Try manual redeploy from dashboard
- Check Vercel Analytics dashboard
- Review Core Web Vitals
- Consider adding edge caching headers
To rollback to a previous deployment:
- Go to Vercel Dashboard
- Navigate to Deployments
- Find the working deployment
- Click ... → Redeploy
The deployment pipeline sends notifications to Discord:
- Title: Vercel Deploy Succeeded (production)
- Color: Green (3066993)
- Includes: Repository, environment, commit, deployment URL
- Title: Vercel Deploy Failed (environment)
- Color: Red (15158332) for production, Orange for preview
- Includes: Error details, commit, deployment URL, workflow run link
- Create a Discord webhook URL
- Add to GitHub repository secrets:
DISCORD_WEBHOOK_URL - Workflows automatically send notifications