Three deployment targets, one shared database, zero single points of failure in the generation pipeline

Architecture Overview

Three deployment targets, one shared database, zero single points of failure in the generation pipeline.

Deployment Topology

Vercel (IAD1)

Next.js 16 App — App Router, React 19, TypeScript. 50+ API routes covering auth, CRUD, AI, billing, and admin. Edge middleware handles auth gating, onboarding redirects, and rate limiting. Rich editors for proposals, contracts, and reports.

Supabase (Cloud)

PostgreSQL + RLS — Multi-tenant isolation across 25+ tables. pgvector extension for 1536-dim embeddings with HNSW index. Auth service (JWT, OAuth, OTP, cookie sessions). Realtime for agent progress streaming. Storage for org logos and proposal images.

Fly.io (ORD)

boots-proposal-worker — TypeScript job processor with retry logic. boots-brain — Python FastAPI 7-agent pipeline. Both communicate via Supabase as shared state (jobs table, agent runs, proposals). No direct HTTP calls between services.

External Services

AI Models

Anthropic Claude — Opus for strategy, Sonnet for writing, Haiku for validation. OpenAI — text-embedding-3-small for vector embeddings.

Payments & Rate Limiting

Stripe — Checkout sessions, webhooks, subscription management. Upstash Redis — Distributed, IP-based rate limiting per endpoint.

Monitoring & Email

Sentry — Error tracking on client, server, and edge. Resend — Transactional email and lead notifications.

Request Flow: Proposal Generation

The generation flow follows a consistent pattern across all creation methods:

  1. User clicks "Generate" — Request hits edge middleware for auth validation
  2. API route validates — Rate limiting checked, session verified, usage limits enforced
  3. Job inserted to Supabase — Job row created with type, payload, and org context
  4. Worker/Brain claims job — Atomic claim via FOR UPDATE SKIP LOCKED prevents duplicates
  5. AI pipeline executes — 7-agent brain pipeline or direct worker generation
  6. Result saved to Supabase — Proposal data written, brain_status updated
  7. UI updates via Realtime — Client receives live progress and final result

Ready to create AI-powered proposals?

Start Free