Skip to main content

Overview

This guide covers deploying the Openlane Console to production, including environment variable configuration, build optimization, and deployment best practices.
Never commit environment files (.env, .env.local, etc.) to version control. Use secure secret management services in production.

Prerequisites

Before deploying, ensure you have:
  • Node.js: Version 24.14.x (required)
  • Package Manager: Bun 1.2.16+ (recommended) or pnpm/npm
  • Database: PostgreSQL instance for backend API
  • Object Storage: Cloudflare R2 or S3-compatible storage for file uploads
  • Domain: Custom domain with SSL certificate
  • API Endpoint: Backend GraphQL API deployed and accessible

Environment Variables

The Console requires various environment variables for different features. These are defined in /turbo.json for build-time validation.

Core Configuration

# Node environment
NODE_ENV=production

# API Configuration
API_REST_URL=https://api.yourdomain.com
NEXT_PUBLIC_OPENLANE_URL=https://console.yourdomain.com
NEXT_PUBLIC_API_GQL_URL=https://api.yourdomain.com/graphql
Variables prefixed with NEXT_PUBLIC_ are exposed to the browser. Keep sensitive values in server-side variables only.

Authentication Settings

# GitHub OAuth
AUTH_GITHUB_ID=your_github_client_id
AUTH_GITHUB_SECRET=your_github_client_secret

# Google OAuth
AUTH_GOOGLE_ID=your_google_client_id.apps.googleusercontent.com
AUTH_GOOGLE_SECRET=your_google_client_secret
Setup Instructions:
1

GitHub OAuth App

  1. Go to GitHub Developer Settings
  2. Create new OAuth App
  3. Set Authorization callback URL:
    https://console.yourdomain.com/api/auth/callback/github
    
  4. Copy Client ID and Client Secret
2

Google OAuth Client

  1. Go to Google Cloud Console
  2. Create OAuth 2.0 Client ID
  3. Add authorized redirect URI:
    https://console.yourdomain.com/api/auth/callback/google
    
  4. Copy Client ID and Client Secret

Integration Settings

# Stripe secret key for billing integration
STRIPE_SECRET_KEY=sk_live_...
Required for:
  • Subscription management
  • Invoice generation
  • Payment processing
  • Usage tracking
Use Stripe test mode keys for development and live mode keys for production.

AI/ML Settings (Optional)

# Enable AI-powered suggestions
NEXT_PUBLIC_AI_SUGGESTIONS_ENABLED=true

# Google AI Configuration
GOOGLE_AI_PROJECT_ID=your-gcp-project-id
GOOGLE_AI_REGION=us-central1
GOOGLE_AI_MODEL_NAME=gemini-pro
GOOGLE_GENERATIVE_AI_API_KEY=your-api-key

# Service account for Vertex AI (base64 encoded JSON)
GOOGLE_SERVICE_ACCOUNT_KEY_B64=base64_encoded_service_account_json

# RAG Corpus for enhanced context
GOOGLE_RAG_CORPUS_ID=your-corpus-id

# GCS bucket for AI logs
GCS_LOG_BUCKET=your-logs-bucket
Setup Service Account:
# Encode service account JSON to base64
cat service-account.json | base64 -w 0 > service-account-b64.txt

Feature Flags

# Enable subscription plan features (optional)
NEXT_PUBLIC_ENABLE_PLAN=true

# Google Maps API for location features (optional)
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your-google-maps-api-key

# Custom domain CNAME value for trust center (optional)
NEXT_PUBLIC_CUSTOMDOMAIN_CNAME=trust.yourdomain.com.cdn.cloudflare.net

Build Configuration

The Console uses Next.js with custom build settings in next.config.mjs:
const nextConfig = {
  reactStrictMode: true,
  
  // Transpile monorepo packages
  transpilePackages: [
    '@repo/dally',
    '@repo/ui',
    '@repo/codegen',
    'survey-core',
    'survey-react-ui'
  ],
  
  // Optimize for production
  experimental: {
    webpackMemoryOptimizations: false,
  },
  
  // Redirects
  async redirects() {
    return [
      {
        source: '/tasks',
        destination: '/automation/tasks',
        permanent: true,
      },
    ]
  },
  
  // Image optimization for Cloudflare R2
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: '*.r2.cloudflarestorage.com',
        pathname: '/**',
      },
    ],
  },
}

Build and Deploy

Local Build

1

Install Dependencies

pnpm install
2

Build Application

# From monorepo root
pnpm --filter console build

# Or using task runner
task build:console
This creates an optimized production build in .next/ directory.
3

Test Production Build

pnpm --filter console start

# Or
task start:console
Runs the production server on port 3001.

Docker Deployment

Create a Dockerfile for containerized deployment:
FROM node:20-alpine AS base

# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate

# Copy package files
COPY package.json pnpm-lock.yaml ./
COPY apps/console/package.json ./apps/console/

# Install dependencies
RUN pnpm install --frozen-lockfile

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Build console app
ENV NEXT_TELEMETRY_DISABLED 1
RUN pnpm --filter console build

# Production image
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/apps/console/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/apps/console/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/apps/console/.next/static ./.next/static

USER nextjs

EXPOSE 3001

ENV PORT 3001

CMD ["node", "server.js"]
Build and run:
docker build -t openlane-console .
docker run -p 3001:3001 --env-file .env.production openlane-console

Vercel Deployment

1

Install Vercel CLI

pnpm install -g vercel
2

Configure Project

Create vercel.json in console directory:
{
  "buildCommand": "pnpm build",
  "devCommand": "pnpm dev",
  "installCommand": "pnpm install",
  "framework": "nextjs",
  "outputDirectory": ".next"
}
3

Set Environment Variables

In Vercel dashboard:
  1. Go to Project Settings → Environment Variables
  2. Add all required environment variables
  3. Set appropriate environments (Production, Preview, Development)
4

Deploy

vercel --prod

Platform-Specific Deployments

  1. Build Docker image
  2. Push to ECR
  3. Create ECS task definition
  4. Configure ALB with SSL certificate
  5. Set environment variables in task definition
  6. Deploy ECS service

Production Checklist

  • All environment variables secured (use secret manager)
  • HTTPS enabled with valid SSL certificate
  • reCAPTCHA configured for login pages
  • OAuth callback URLs whitelisted
  • CORS configured properly in API
  • Rate limiting enabled on auth endpoints
  • Session secrets rotated
  • CSP headers configured
  • Next.js production build optimized
  • Image optimization configured
  • CDN configured for static assets
  • Database connection pooling enabled
  • Redis cache for session storage
  • Monitoring and APM configured
  • Load balancer health checks configured
  • Database backups automated
  • Application logs aggregated
  • Error tracking configured (Sentry, etc.)
  • Uptime monitoring enabled
  • Auto-scaling policies configured
  • Disaster recovery plan documented
  • Fallback mechanisms tested
  • Data encryption at rest and in transit
  • Audit logging enabled
  • Data retention policies configured
  • Privacy policy and ToS linked
  • GDPR compliance measures (if applicable)
  • SOC 2 controls implemented (if applicable)

Monitoring and Logging

Application Logs

# View logs in production
pm2 logs openlane-console

# Docker logs
docker logs -f container_id

# Cloud platform logs
vercel logs
gcloud logging read
aws logs tail

Health Checks

Implement health check endpoint:
// app/api/health/route.ts
export async function GET() {
  return Response.json({
    status: 'healthy',
    timestamp: new Date().toISOString(),
    version: process.env.npm_package_version,
  })
}

Metrics

Track key metrics:
  • Response times
  • Error rates
  • Active sessions
  • API latency
  • Database query performance
  • Cache hit rates

Troubleshooting

Problem: Build fails with TypeScript errorsSolutions:
  1. Ensure all dependencies are installed: pnpm install
  2. Clear build cache: rm -rf .next
  3. Check TypeScript version compatibility
  4. Verify @repo/codegen is built first
Problem: Features not working due to missing env varsSolutions:
  1. Check turbo.json for required variables
  2. Verify variables are set in deployment platform
  3. Restart application after updating env vars
  4. Check browser console for NEXT_PUBLIC_ variable issues
Problem: OAuth or SSO not workingSolutions:
  1. Verify callback URLs match exactly
  2. Check OAuth credentials are for correct environment
  3. Ensure HTTPS is enabled in production
  4. Verify cookie domain settings
  5. Check NextAuth configuration

Next Steps

Authentication

Configure auth providers and SSO

Monitoring

Set up monitoring and alerting

API Reference

Integrate with Console APIs

Troubleshooting

Common issues and solutions

Build docs developers (and LLMs) love