SOMA docs
Ops

Deploy

Vercel-only. One target, one command.

Everything deploys to Vercel. No Docker, no Fly, no separate worker processes.

First-time setup

# 1. Link the project
vercel link --yes --project soma

# 2. Push env from Doppler → Vercel
doppler secrets download --project soma --config prod --no-file --format env \
  | while IFS='=' read -r key val; do
      printf '%s' "${val%\"}" | sed 's/^"//' \
        | vercel env add "$key" production --force
    done

# 3. Deploy
vercel --prod --yes

Ongoing deploys

vercel --prod --yes

Or push to main when the Vercel Git integration is wired (not yet; we deploy via CLI for now).

What's in vercel.json

The monorepo needs explicit install + build commands since apps/web doesn't have its own pnpm-lock.yaml:

{
  "installCommand": "cd ../.. && corepack enable && pnpm install --frozen-lockfile",
  "buildCommand": "cd ../.. && pnpm --filter @soma/web build",
  "outputDirectory": ".next",
  "framework": "nextjs"
}

Project-level setting rootDirectory: apps/web is configured via the Vercel API (set during project creation).

DB migrations

Separate from app deploys. Run manually when schema changes:

doppler run --project soma --config prod -- pnpm db:setup

Order of operations (handled by scripts/db-setup.ts):

  1. Apply packages/db/rls/0001_extensions.sql (creates vector, pg_trgm, uuid-ossp).
  2. Run Drizzle migrations from packages/db/migrations/.
  3. Apply the rest of packages/db/rls/*.sql (RLS policies, triggers, auth mirror).

Idempotent — re-running is safe.

Post-deploy wiring

One-time, after the first deploy:

  1. Inngest CloudApps → Sync a new app → https://soma-ai.cc/api/inngest. Subsequent deploys auto-sync via PUT /api/inngest introspection.

  2. Telegram webhook — one curl to register:

    TG=$(doppler secrets get TELEGRAM_BOT_TOKEN --project soma --config prod --plain)
    WS=$(doppler secrets get TELEGRAM_WEBHOOK_SECRET --project soma --config prod --plain)
    curl -X POST "https://api.telegram.org/bot${TG}/setWebhook" \
      -H "Content-Type: application/json" \
      -d "{\"url\":\"https://soma-ai.cc/api/telegram/webhook\",\"secret_token\":\"${WS}\",\"allowed_updates\":[\"message\"]}"
  3. Google Pub/Sub — create a Pub/Sub topic in Google Cloud, subscribe it with a push endpoint to https://soma-ai.cc/api/webhooks/gmail?token=<GMAIL_PUBSUB_TOKEN>, and call users.watch per connected user.

Rollback

vercel rollback

Rolls the alias back to the previous deployment. Instant.