Skip to main content

Overview

This guide covers deploying Polaris IDE to production using Vercel, Convex, and Trigger.dev.
Vercel is recommended due to its seamless Next.js integration and automatic deployments.

Prerequisites

Vercel Account

Sign up at vercel.com

Production Services

  • Convex production deployment
  • Trigger.dev production project
  • Stack Auth production project

Deployment Steps

1. Prepare Convex Production Database

1

Create production deployment

npx convex deploy --prod
This creates a separate production database and provides a production URL.
2

Note production URL

Copy the URL shown (format: https://your-deployment.convex.cloud)
3

Configure authentication

Update convex/auth.config.ts to support both development and production:
import { getConvexProvidersConfig } from "@stackframe/stack";

export default {
  providers: getConvexProvidersConfig({
    projectId: process.env.NEXT_PUBLIC_STACK_PROJECT_ID!,
  }),
};

2. Configure Trigger.dev Production

1

Create production environment

  1. Go to trigger.dev
  2. Navigate to your project
  3. Create a “Production” environment
  4. Copy the production API key
2

Deploy tasks

npx trigger.dev deploy
This uploads your background tasks to Trigger.dev’s infrastructure.

3. Set Up Stack Auth Production

1

Create production project

  1. Go to Stack Auth dashboard
  2. Create a new project or switch to production mode
  3. Copy production keys
2

Configure allowed domains

Add your production domain to allowed origins:
  • https://your-app.vercel.app
  • https://yourdomain.com (if using custom domain)
3

Set up Convex integration

Configure Stack Auth to work with Convex production URL.

4. Deploy to Vercel

# Install Vercel CLI
npm i -g vercel

# Login to Vercel
vercel login

# Deploy
vercel --prod

5. Environment Variables

Add these environment variables in Vercel dashboard:
NEXT_PUBLIC_STACK_PUBLISHABLE_KEY=pk_prod_xxx
STACK_SECRET_KEY=sk_prod_xxx
NEXT_PUBLIC_CONVEX_URL=https://your-prod-deployment.convex.cloud
CONVEX_DEPLOYMENT=prod:your-deployment-name
POLARIS_CONVEX_INTERNAL_KEY=your_secure_random_string_prod
TRIGGER_SECRET_KEY=tr_prod_xxx
# OpenRouter (Recommended)
OPENROUTER_API_KEY=sk-or-xxx

# Or Cerebras (Free alternative)
CEREBRAS_API_KEY=csk-xxx
# Sentry - Error tracking
SENTRY_DSN=https://[email protected]/xxx

# Firecrawl - Documentation scraping
FIRECRAWL_API_KEY=fc-xxx

# Autumn - Subscription billing
AUTUMN_SECRET_KEY=sk_live_xxx
AUTUMN_API_URL=https://api.autumncollective.com
NEXT_PUBLIC_AUTUMN_PRO_MONTHLY_PRODUCT_ID=prod_xxx
NEXT_PUBLIC_AUTUMN_PRO_YEARLY_PRODUCT_ID=prod_xxx
# Node.js version
NODE_VERSION=20

# Enable standalone output for optimized builds
NEXT_BUILD_STANDALONE=true
Never commit production secrets to Git. Use Vercel’s environment variable dashboard.

6. Configure Custom Domain (Optional)

1

Add domain in Vercel

  1. Go to Project Settings → Domains
  2. Add your domain (e.g., polaris-ide.com)
  3. Follow DNS configuration instructions
2

Update Stack Auth

Add custom domain to Stack Auth allowed origins
3

Update environment variables

If using domain-specific configs, update:
  • NEXT_PUBLIC_APP_URL
  • Any hardcoded URLs in code

Post-Deployment

Verify Deployment

Monitor Performance

Vercel Analytics

Monitor Core Web Vitals and performance metrics in Vercel dashboard

Sentry

Track errors, performance issues, and AI monitoring

Convex Dashboard

Monitor database queries, function calls, and real-time connections

Trigger.dev

Track background job executions and failures

Set Up Monitoring

Use services like:Monitor endpoints:
  • / - Homepage
  • /api/health - Health check (if implemented)

CI/CD Pipeline

Automatic Deployments

Vercel automatically deploys:
  • Production: Pushes to main branch
  • Preview: Pull requests and feature branches

Custom Build Process

Add vercel.json for custom configuration:
vercel.json
{
  "installCommand": "bun install",
  "buildCommand": "bun run build",
  "framework": "nextjs",
  "regions": ["iad1"],
  "env": {
    "NODE_VERSION": "20"
  }
}

Pre-deployment Checks

Create GitHub Actions workflow:
.github/workflows/ci.yml
name: CI

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
      
      - name: Install dependencies
        run: npm ci
      
      - name: Run linter
        run: npm run lint
      
      - name: Type check
        run: npx tsc --noEmit
      
      - name: Run tests
        run: npm test
      
      - name: Build
        run: npm run build

Scaling Considerations

Convex scales automatically, but consider:
  • Index optimization for large datasets
  • Query pagination for large result sets
  • Archiving old conversations/messages
Trigger.dev handles scaling, but:
  • Set appropriate concurrency limits
  • Use queues for high-volume tasks
  • Monitor job execution times
  • Use Vercel’s CDN for static files
  • Optimize images with next/image
  • Implement lazy loading
Monitor and implement rate limiting:
  • AI API calls (OpenRouter/Cerebras)
  • Convex function calls
  • Trigger.dev job invocations

Rollback Strategy

1

Identify issue

Use Sentry and Vercel logs to diagnose the problem
2

Instant rollback

In Vercel dashboard:
  1. Go to Deployments
  2. Find last working deployment
  3. Click ”…” → “Promote to Production”
3

Or revert Git commit

git revert HEAD
git push origin main
4

Verify rollback

Test critical functionality after rollback

Troubleshooting

Issue: Build fails on VercelSolutions:
  1. Check build logs in Vercel dashboard
  2. Verify all environment variables are set
  3. Test build locally: npm run build
  4. Check Node.js version compatibility
Issue: Users can’t sign inSolutions:
  1. Verify Stack Auth production keys
  2. Check allowed domains in Stack Auth dashboard
  3. Ensure NEXT_PUBLIC_STACK_PUBLISHABLE_KEY is set
  4. Check browser console for CORS errors
Issue: Convex queries failSolutions:
  1. Verify NEXT_PUBLIC_CONVEX_URL is correct
  2. Check Convex deployment status
  3. Ensure auth integration is configured
  4. Test queries in Convex dashboard
Issue: Trigger.dev tasks don’t executeSolutions:
  1. Verify TRIGGER_SECRET_KEY is set
  2. Check task deployment: npx trigger.dev deploy
  3. Monitor Trigger.dev dashboard for errors
  4. Ensure webhook endpoints are accessible

Next Steps

Electron Deployment

Build and distribute desktop app

Error Tracking

Set up comprehensive error monitoring

Architecture

Understand the system design

Contributing

Contribute improvements

Build docs developers (and LLMs) love