Skip to main content
This guide covers deploying KaireonAI using a fully managed cloud stack — no servers to maintain, automatic scaling, and managed databases.

Architecture

Production Stack

ServiceProviderPurposePricing
App RuntimeAWS App RunnerHosts the Next.js applicationPay per vCPU/memory
DatabaseSupabase (PostgreSQL)Primary data store via Prisma 7Free tier available
CacheUpstash (Redis)Enrichment caching, rate limitingFree tier available
DNSRoute 53Domain management~$0.50/zone/month
CDNCloudFrontMarketing site + static assetsPay per request
Container RegistryAmazon ECRDocker image storagePay per GB

Step-by-Step Setup

1

Create a Supabase project

  1. Go to supabase.com and create a new project
  2. Choose a region close to your App Runner deployment
  3. Copy the Connection string (Settings → Database → URI)
  4. The format is: postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres
Use the Session mode connection string (port 5432), not the pooler (port 6543), for Prisma migrations. App Runner can use either.
2

Create an Upstash Redis database

  1. Go to upstash.com and create a new Redis database
  2. Choose the same region as your Supabase project
  3. Copy the Redis URL (starts with rediss://)
  4. Upstash provides TLS by default — the rediss:// protocol handles encryption
3

Push Docker image to ECR

# Authenticate with ECR
aws ecr get-login-password --region us-east-1 | \
  docker login --username AWS --password-stdin 422500312304.dkr.ecr.us-east-1.amazonaws.com

# Build and push
docker build -t kaireon-api .
docker tag kaireon-api:latest 422500312304.dkr.ecr.us-east-1.amazonaws.com/kaireon-api:latest
docker push 422500312304.dkr.ecr.us-east-1.amazonaws.com/kaireon-api:latest
4

Create App Runner service

  1. Go to the AWS App Runner console
  2. Choose Container registry → Amazon ECR as the source
  3. Select the kaireon-api repository and latest tag
  4. Configure:
    • CPU: 1 vCPU (or 2 for production)
    • Memory: 2 GB (or 4 for production)
    • Port: 3000
  5. Add environment variables:
DATABASE_URL=postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:5432/postgres
REDIS_URL=rediss://default:[password]@[host].upstash.io:6379
NEXTAUTH_SECRET=[generate-a-secure-random-string]
NEXTAUTH_URL=https://your-domain.com
NODE_ENV=production
5

Initialize the database

Run migrations against your Supabase database from your local machine:
DATABASE_URL="postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:5432/postgres" \
  npx prisma db push
Then seed the admin user:
DATABASE_URL="postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:5432/postgres" \
  npx tsx prisma/seed.ts
6

Configure custom domain (optional)

  1. In App Runner, go to Custom domains and add your domain
  2. Create a CNAME record in Route 53 pointing to the App Runner URL
  3. App Runner automatically provisions and renews TLS certificates

Updating

To deploy a new version:
# Build with git SHA tag
SHA=$(git rev-parse --short HEAD)
docker build -t kaireon-api .
docker tag kaireon-api:latest 422500312304.dkr.ecr.us-east-1.amazonaws.com/kaireon-api:$SHA
docker tag kaireon-api:latest 422500312304.dkr.ecr.us-east-1.amazonaws.com/kaireon-api:latest
docker push 422500312304.dkr.ecr.us-east-1.amazonaws.com/kaireon-api:$SHA
docker push 422500312304.dkr.ecr.us-east-1.amazonaws.com/kaireon-api:latest
App Runner automatically redeploys when you push a new image (if auto-deployment is enabled), or you can trigger a manual deployment from the console.

Monitoring

  • App Runner logs — Available in the App Runner console or CloudWatch
  • Supabase dashboard — Monitor database connections, query performance, and storage
  • Upstash dashboard — Monitor Redis commands, memory usage, and latency

Next Steps