Architecture

Edge runtime, server functions, data model and AI routing.

Stack

  • Frontend — React 19, TanStack Router/Start v1, Vite 7, Tailwind v4.
  • Backend — TanStack server functions running on an edge runtime.
  • Database + auth — managed Postgres with Row-Level Security.
  • AI — server-side model routing; keys never reach the browser.
  • Payments — Razorpay, INR, one-time orders.
  • Email — transactional templates through managed email infrastructure.

Request path

  1. The browser calls a typed server function with the session bearer token attached.
  2. Auth middleware verifies the token and resolves the user before the handler runs.
  3. The handler reads limits, calls the model server-side and records usage.
  4. The response streams or returns; nothing sensitive crosses the boundary.

Data model highlights

TableHoldsAccess
conversations / messagesCode Studio historyOwner only via RLS
brand_profilesTone and audience memoryOwner only
saved schemasSynthetic data definitionsOwner only
user_plansActive plan and expiryOwner read, service write
user_rolesRole assignmentsRead via has_role() only
processed_webhook_eventsReplay protectionService role only
abuse_logRate-limit offendersService role only