Documentation Index
Fetch the complete documentation index at: https://docs.getsabo.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before deploying, ensure you have:Required
Required
- Vercel account (Sign up free)
- Git repository (GitHub, GitLab, or Bitbucket) with your Sabo project pushed
- Supabase project configured with database migration applied (Database with Supabase)
- Local environment working (
pnpm devruns successfully with all features)
Optional (for full features)
Optional (for full features)
- Stripe account configured for payments (Setup guide)
- PostHog account for analytics (Setup guide)
- Custom domain (can be added after initial deployment)
pnpm build locally to catch any build errors before deploying.Step-by-Step Deployment
Import project to Vercel
- Go to Vercel Dashboard
- Click Add New… → Project
- Select your Git provider and authorize access
- Choose your Sabo repository from the list
- Vercel will auto-detect Next.js settings:
- Framework Preset: Next.js
- Root Directory:
./(or./saboif using a monorepo) - Build Command:
pnpm run build(runs thebuildscript which callsnext build) - Output Directory:
.next(auto-detected) - Install Command:
pnpm install(auto-detected frompnpm-lock.yaml)
Configure environment variables
Core Variables (Required)
Stripe Variables (Required for payments)
PostHog Variables (Optional, for analytics)
Testing Variables (Optional, for E2E tests)
Environment Variable Scopes
For each variable, select the appropriate scope:- Production - Live site environment
- Preview - Pull request and branch preview deployments
- Development - Local development (usually not needed; use
.env.local)
Update Supabase Auth URLs
- Go to Supabase Dashboard → Your Project
- Navigate to Authentication → URL Configuration
-
Update Site URL to:
(or your custom domain:
https://yourdomain.com) -
Add to Redirect URLs (comma-separated list):
-
For preview deployments, add a wildcard pattern:
https://*-your-project.vercel.app/auth/callback) allows all Vercel preview URLs to work with authentication. This is optional but recommended for testing auth in preview deployments.Configure Stripe webhook (for payments)
- Go to Stripe Dashboard
- Toggle to Live mode (top-right corner)
- Click Add endpoint
-
Set Endpoint URL to:
(Use your actual domain, not
.vercel.app) -
Select Events to send:
customer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.payment_succeededinvoice.payment_failed
- Click Add endpoint
-
Copy the Signing secret (starts with
whsec_...) - Go back to Vercel Dashboard → Your Project → Settings → Environment Variables
-
Update
STRIPE_WEBHOOK_SECRETwith the new signing secret - Redeploy your project for the new secret to take effect
Deploy to production
- In the Vercel project configuration screen, click Deploy
- Vercel will build your project and deploy it
- Monitor the build logs for errors
- Make a commit to your repository:
- Vercel automatically deploys on every push to your main branch
Verify deployment
- Marketing Pages
- Authentication
- Dashboard
- Payments (Stripe)
- Homepage:
https://yourdomain.com/ - Pricing:
https://yourdomain.com/pricing - Contact:
https://yourdomain.com/contact - Blog:
https://yourdomain.com/blog - Changelog:
https://yourdomain.com/changelog - Legal pages:
/privacy,/terms-of-service,/cookie-policy
Add custom domain (optional)
- Go to Vercel Dashboard → Your Project → Settings → Domains
- Click Add and enter your domain (e.g.,
yourdomain.com) - Follow DNS configuration instructions:
- For root domain (
yourdomain.com): Add A record pointing to Vercel’s IP - For subdomain (
www.yourdomain.com): Add CNAME record pointing tocname.vercel-dns.com
- For root domain (
- Wait for DNS propagation (usually 5-60 minutes)
- Vercel automatically issues SSL certificate via Let’s Encrypt
-
Update environment variable in Vercel:
-
Update Supabase Auth URLs:
- Site URL:
https://yourdomain.com - Add redirect URL:
https://yourdomain.com/auth/callback
- Site URL:
-
Update Stripe webhook endpoint URL:
- Change endpoint URL to:
https://yourdomain.com/api/webhooks/stripe - Copy new signing secret to Vercel env vars
- Change endpoint URL to:
- Redeploy your project for all changes to take effect
Set up preview deployments
- Preview URLs:
https://your-project-git-branchname-yourteam.vercel.app - Pull request previews: Each PR gets a unique preview URL
- Automatic deployment: Push to any branch triggers a preview build
- Go to Vercel Dashboard → Your Project → Settings → Environment Variables
- Add variables with Preview scope
- Previews will use these instead of Production values
- Testing with Stripe test mode
- Using a staging Supabase database
- Sharing work-in-progress with your team
Production Optimization
Performance
Sabo is optimized for Vercel out of the box:- Automatic CDN caching for static assets
- Edge runtime for fast middleware execution
- Image optimization via Next.js Image component
- Static generation for blog and changelog (built from MDX at deploy time—redeploy when content changes)
- Server-side rendering (SSR) for dynamic pages
Build Settings
Default build settings work for most cases:Environment Management
Organize environment variables by environment:| Environment | Use Case | Example Keys |
|---|---|---|
| Production | Live site with real users | sk_live_..., production Supabase |
| Preview | PR/branch testing | sk_test_..., staging Supabase |
| Development | Local dev (.env.local) | sk_test_..., local Supabase |
.env.local for local development.Troubleshooting
Build fails with 'Module not found' or TypeScript errors
Build fails with 'Module not found' or TypeScript errors
- Build logs show module import errors
- TypeScript compilation fails
-
Verify all dependencies are in
package.json: -
Check for missing environment variables:
- Build-time code referencing env vars will fail if vars are missing
- Add missing vars in Vercel Dashboard
-
Clear build cache:
- Vercel Dashboard → Deployments → Latest build → … menu → Redeploy
- Check “Clear build cache and redeploy”
-
Local build test:
If it fails locally, fix errors before deploying.
Environment variables not working
Environment variables not working
process.env.VARIABLE_NAMEisundefined- Features work locally but not in production
-
Check variable naming:
- Client-side variables must start with
NEXT_PUBLIC_ - Server-only variables should not have
NEXT_PUBLIC_prefix
- Client-side variables must start with
-
Verify variable scope:
- Go to Vercel Dashboard → Settings → Environment Variables
- Ensure variables have correct scope (Production/Preview/Development)
-
Redeploy after adding variables:
- Environment variables are only loaded at build time
- After adding/changing vars, trigger a new deployment
-
Check for typos:
- Variable names are case-sensitive
SUPABASE_URL≠SUPABASE_url
Authentication callback fails (Supabase)
Authentication callback fails (Supabase)
- After signing in with OAuth, user sees error page
- Email verification links redirect to error page
- Console shows CORS or redirect errors
-
Check Supabase Redirect URLs:
- Go to Supabase Dashboard → Authentication → URL Configuration
- Ensure your Vercel domain is in Redirect URLs list
- Format:
https://yourdomain.com/auth/callback
-
Verify Site URL matches:
NEXT_PUBLIC_SITE_URLin Vercel must match Supabase Site URL- Include protocol (
https://), no trailing slash
-
Check for browser redirects:
- Open browser DevTools → Network tab
- Look for redirect chain
- Verify final redirect goes to
/auth/callback
-
Test with different browsers/incognito:
- Clear browser cache and cookies
- Try in incognito/private window
- Some browsers block third-party cookies
Stripe webhook not receiving events
Stripe webhook not receiving events
- Subscriptions don’t update in database
- Payments succeed but user subscription status unchanged
- Stripe Dashboard shows “Endpoint not responding”
-
Verify endpoint URL is correct:
- Stripe Dashboard → Webhooks → Your endpoint
- URL should be:
https://yourdomain.com/api/webhooks/stripe - Must use custom domain, not
.vercel.app(for live mode)
-
Check webhook signing secret:
- Ensure
STRIPE_WEBHOOK_SECRETin Vercel matches endpoint secret - Use live mode secret (
whsec_...) for production
- Ensure
-
Test webhook delivery:
- Stripe Dashboard → Webhooks → Your endpoint
- Click Send test webhook
- Select event type (e.g.,
invoice.payment_succeeded) - Check Vercel logs for processing
-
Review Vercel Function Logs:
- Vercel Dashboard → Your Project → Logs
- Filter by
/api/webhooks/stripe - Look for errors or webhook signature verification failures
-
Ensure events are selected:
- Webhook endpoint must listen for:
customer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.payment_succeededinvoice.payment_failed
- Webhook endpoint must listen for:
PostHog analytics not tracking events
PostHog analytics not tracking events
- No events appear in PostHog dashboard
- Console shows “PostHog is not initialized”
-
Verify environment variables are set:
-
Redeploy after adding PostHog vars:
- PostHog only initializes if env vars are present at build time
-
Check browser console:
- Open DevTools → Console
- Look for PostHog initialization messages
- Check Network tab for requests to
app.posthog.com
-
Verify PostHog project is active:
- PostHog Dashboard → Project Settings
- Ensure project is not paused or archived
Production build is slow or times out
Production build is slow or times out
- Vercel build exceeds time limit (10 minutes on free plan)
- Build gets stuck on specific step
-
Optimize dependencies:
-
Check for large files in repo:
- Avoid committing
node_modules/,.next/, or large assets - Use
.gitignoreto exclude build artifacts
- Avoid committing
-
Upgrade Vercel plan:
- Free tier: 10-minute build limit
- Pro tier: 45-minute build limit
-
Split large pages:
- Use dynamic imports for heavy components
- Implement code splitting for route segments
404 errors on page refresh
404 errors on page refresh
- Direct URL navigation works
- Refreshing page shows 404
-
This should not happen with Vercel + Next.js App Router.
- Vercel automatically handles Next.js routing
-
Check Vercel routing configuration:
- Vercel Dashboard → Project Settings → General
- Ensure “Framework Preset” is set to Next.js
-
Verify build output:
- Check Vercel build logs
- Ensure
.nextdirectory contains expected routes
-
Test with
vercel dev:Run locally with Vercel’s dev server to debug routing
Continuous Deployment
Vercel automatically deploys on every push to your Git repository:Deployment Triggers
| Action | Result |
|---|---|
Push to main branch | Deploys to Production |
| Push to any other branch | Creates Preview deployment |
| Open pull request | Creates Preview with comment link |
| Merge PR | Deploys to Production |
Deployment Protection
Enable deployment protection for production:- Vercel Dashboard → Project Settings → Git
- Enable Production Deployment Protection
- Only designated team members can approve production deploys