Skip to main content

Overview

Vercel offers the fastest deployment path for Kuest Prediction Market with one-click Supabase integration. This guide covers the complete deployment process including environment configuration, database setup, and domain management.
Vercel deployment is the recommended approach for most users. It includes automatic Supabase integration, serverless functions, and built-in cron jobs.

Prerequisites

Before deploying to Vercel, ensure you have:

Deployment Steps

1
Fork the Repository
2
  • Star the repository on GitHub
  • Fork the repository to your account
  • Clone your fork locally (optional for local development)
  • 3
    Configure Environment Variables
    4
    Download the .env.example file and configure the required variables:
    5
    .env.example
    # ============================================================
    # REQUIRED
    # ============================================================
    
    # Get your Kuest CLOB Auth credentials by connecting your EVM wallet at https://auth.kuest.com
    KUEST_ADDRESS=""
    KUEST_API_KEY=""
    KUEST_API_SECRET=""
    KUEST_PASSPHRASE=""
    
    # Admin wallets (comma-separated, EVM 0x... addresses on Polygon)
    ADMIN_WALLETS=""
    
    # Your REOWN APPKIT project id http://dashboard.reown.com/
    REOWN_APPKIT_PROJECT_ID=""
    
    # Random 32 characters – generate one at https://www.better-auth.com/docs/installation#set-environment-variables
    BETTER_AUTH_SECRET=""
    
    # Vercel Cron Jobs (Create a random secret of at least 16 characters)
    CRON_SECRET=""
    
    # ============================================================
    # OPTIONAL
    # ============================================================
    
    # Enable Next.js image optimization (can increase Vercel costs)
    IMAGE_OPTIMIZATION=false
    
    6
    Changing BETTER_AUTH_SECRET after deployment will invalidate all user sessions and encrypted credentials, requiring users to log in and re-authenticate for trading.
    7
    Create Vercel Project
    8
  • Go to Vercel Dashboard
  • Click Add NewProject
  • Connect your GitHub account if not already connected
  • Find and click Import on your forked repository
  • In the import modal, open Environment Variables
  • Click Import .env and select your edited .env.example file
  • Click Deploy
  • Wait for the initial deployment to complete
  • Click Continue to Dashboard when finished
  • 9
    Create Supabase Database
    10
    Vercel offers native Supabase integration:
    11
  • Open your Vercel project dashboard
  • Navigate to Storage tab
  • Click Create DatabaseSupabase
  • Use default settings (create Supabase account if prompted)
  • Click Create and wait for provisioning
  • Click Connect Project on the confirmation screen
  • 12
    This automatically configures:
    13
  • POSTGRES_URL - Database connection string
  • SUPABASE_URL - Supabase project URL
  • SUPABASE_SERVICE_ROLE_KEY - Service role key for storage
  • 14
    Supabase integration includes:
    • PostgreSQL database (500MB free tier)
    • Object storage bucket (kuest-assets)
    • Automatic cron job scheduling via Supabase Edge Functions
    15
    Redeploy with Database
    16
  • Open Deployments tab in your Vercel project
  • Click the three dots () next to the latest deployment
  • Select Redeploy
  • Check Use existing Build Cache (optional)
  • Click Redeploy to confirm
  • 17
    This deployment will include the Supabase environment variables.
    18
    Configure Custom Domain (Optional)
    19
    After the initial deployment is stable:
    20
  • Navigate to SettingsDomains
  • Click Add Domain
  • Enter your custom domain (e.g., markets.example.com)
  • Follow the DNS configuration instructions
  • Wait for DNS propagation (usually 5-30 minutes)
  • Vercel will automatically provision SSL certificate
  • 21
    After adding a custom domain, update SITE_URL in your environment variables to match your production domain, then redeploy.
    22
    Enable GitHub Actions
    23
    To keep your fork synchronized with upstream updates:
    24
  • Go to your forked repository on GitHub
  • Navigate to SettingsActionsGeneral
  • Under Actions permissions, select Allow all actions and reusable workflows
  • Click Save
  • 25
    Complete Admin Setup
    26
  • Visit your deployed site
  • Log in with a wallet address listed in ADMIN_WALLETS
  • Navigate to AdminGeneral
  • Configure:
    • Company name and branding
    • Trading fees
    • Market categories
    • Theme customization
  • Environment Variables Reference

    Required Variables

    VariableDescriptionExample
    KUEST_ADDRESSYour Kuest wallet address on Polygon0x1234...
    KUEST_API_KEYAPI key from auth.kuest.com-
    KUEST_API_SECRETAPI secret from auth.kuest.com-
    KUEST_PASSPHRASEAPI passphrase from auth.kuest.com-
    ADMIN_WALLETSComma-separated admin addresses0x123...,0x456...
    REOWN_APPKIT_PROJECT_IDReown project ID-
    BETTER_AUTH_SECRET32-character random string-
    CRON_SECRET16+ character random string-

    Auto-Configured by Vercel

    These are automatically set when you connect Supabase:
    VariableDescription
    POSTGRES_URLPostgreSQL connection string
    SUPABASE_URLSupabase project URL
    SUPABASE_SERVICE_ROLE_KEYSupabase service role key

    Optional Variables

    VariableDescriptionDefault
    IMAGE_OPTIMIZATIONEnable Next.js image optimizationfalse
    SENTRY_DSNSentry error tracking DSN-
    SENTRY_ORGSentry organization-
    SENTRY_PROJECTSentry project name-
    SENTRY_AUTH_TOKENSentry auth token-

    Vercel-Specific Features

    Automatic Cron Jobs

    When using Supabase mode on Vercel, cron jobs are automatically configured via vercel.json:
    {
      "crons": [
        {
          "path": "/api/sync/events",
          "schedule": "*/5 * * * *"
        },
        {
          "path": "/api/sync/resolution",
          "schedule": "*/5 * * * *"
        },
        {
          "path": "/api/sync/translations",
          "schedule": "*/10 * * * *"
        },
        {
          "path": "/api/sync/volume",
          "schedule": "*/30 * * * *"
        }
      ]
    }
    

    Serverless Functions

    All API routes automatically deploy as serverless functions with:
    • 10-second execution timeout (Hobby)
    • 60-second execution timeout (Pro)
    • Automatic scaling
    • Edge network distribution

    Build Configuration

    Vercel automatically detects the Next.js framework and uses optimal settings:
    {
      "buildCommand": "npm run build",
      "outputDirectory": ".next",
      "framework": "nextjs"
    }
    

    Troubleshooting

    Deployment Failed

    1. Check build logs in Vercel dashboard
    2. Verify all required environment variables are set
    3. Ensure BETTER_AUTH_SECRET is exactly 32 characters
    4. Check for syntax errors in .env file

    Database Connection Issues

    1. Verify Supabase integration is connected in Vercel Storage
    2. Check POSTGRES_URL format in environment variables
    3. Redeploy after connecting Supabase
    4. Check Supabase dashboard for database status

    Cron Jobs Not Running

    1. Verify CRON_SECRET is set in environment variables
    2. Check Vercel deployment logs for cron execution
    3. Ensure Supabase mode is properly configured
    4. Verify cron endpoints are accessible

    Custom Domain SSL Issues

    1. Wait 24 hours for DNS propagation
    2. Verify DNS records match Vercel requirements
    3. Check domain provider for DNSSEC conflicts
    4. Remove and re-add domain in Vercel settings

    Maintenance

    Updating Your Deployment

    To deploy updates from upstream:
    1. Sync your fork with the upstream repository
    2. Vercel automatically deploys on git push to main branch
    3. Monitor deployment in Vercel dashboard
    4. Verify changes in production

    Database Migrations

    Database schema updates are handled automatically through:
    1. Build-time migration scripts
    2. Supabase migration tracking
    3. Zero-downtime deployment strategy

    Monitoring

    Monitor your deployment through:
    • Vercel Analytics: Usage, performance, Core Web Vitals
    • Supabase Dashboard: Database queries, storage usage
    • Vercel Logs: Function execution, errors
    • Sentry (optional): Error tracking and performance monitoring

    Scaling Considerations

    Free Tier Limits

    • 100GB bandwidth per month
    • 100 serverless function invocations per day
    • 500MB PostgreSQL storage (Supabase free tier)
    • 1GB file storage (Supabase free tier)

    Upgrading to Pro

    Consider upgrading when you need:
    • Custom domains on team projects
    • Longer function timeouts (60s)
    • Advanced analytics
    • Priority support
    • Password protection
    • More team members

    Next Steps

    Build docs developers (and LLMs) love