← All posts

· Research AI

Shipping Research AI: Vercel for UI, Fly for Worker + SQLite

Research AI reuses the Invest AI deployment shape:

LayerWhere
Next.jsVercel — repo root, auto-deploy on main
FastAPI + workerFly.io — xingai-research-ai-api
Cache + rate limitsFly volume researchai_data → /data

One Docker image starts both processes via scripts/fly-start.sh. GitHub Actions deploys when backend paths change.

Wiring the frontend

Vercel sets:

RESEARCH_API_URL=<RESEARCH_API_BASE_URL>
NEXT_PUBLIC_SITE_URL=https://research.xingai.app

Next.js /api/research* routes proxy to Fly. Trending chips hit /api/trending with timeout fallback to static seeds.

What we skipped

  • Separate worker machine — colocated for MVP cost
  • Redis — SQLite KV is enough at current scale (ADR-003)

Ops checklist

  • Fly secrets: OPENAI_API_KEY
  • Health: /api/v2/health
  • Volume attached before first deploy

Same playbook as production runbook for Invest AI, different app name and cache keys.

Further reading: xingai-research-ai/docs/deploy/fly-io.md