rerAI is an autonomous permitting assistant for Pune, Maharashtra. This repo is a monorepo with a React frontend, a Convex app for auth and app state, and a Python backend that runs the rerAI graph behind a FastAPI service.
The request path is:
- the rerAI frontend authenticates the user
- the frontend calls the FastAPI backend directly for LangGraph-compatible thread/run traffic
- the backend validates the Convex bearer token and checks thread ownership through Convex
- the FastAPI backend runs the graph and returns a LangGraph-compatible SSE response
Important implication:
- the backend is the public agent API boundary
- Convex remains the identity and app-data source
- the backend requires
Authorization: Bearer <Convex auth token>on every route except/ok
apps/backend: Python backend for the rerAI graph runtime, managed withuvapps/web: React + TypeScript + Vite frontendapps/convex: Convex app for auth, thread ownership, message persistence, and backend ownership checks
The backend keeps the existing rerai_agent.graph graph and exposes the subset of the LangGraph thread/run API that the current app already uses.
Current MVP backend behavior:
- FastAPI service, not
langgraph dev - LangGraph-compatible endpoints for assistants, threads, state/history, and streaming runs
- LangGraph checkpoint/store persistence via
DATABASE_URI - rerAI-owned metadata tables for threads, runs, and resumable SSE replay
- single-process in-memory streaming fanout for MVP1
Current limitations:
- no Redis-backed multi-replica streaming yet
- no full Agent Server parity
- backend-side auth is still trust-based behind Convex/private networking
- Bun
- Python 3.13
uv
Workspace dependencies:
bun installBackend dependencies:
cd apps/backend && /home/partha/.local/bin/uv syncCopy the backend env template to the repo root:
cp apps/backend/.env.example .envMinimum backend variables:
DATABASE_URIOPENROUTER_API_KEYCHROMA_API_KEYCHROMA_TENANTCHROMA_DATABASE
App-level variables also matter:
- the backend needs
CONVEX_URLso it can validate users and thread ownership through Convex - the backend needs
CLIENT_ORIGINSfor CORS - the web app needs
VITE_CONVEX_URLandVITE_BACKEND_URL
bun run devThis starts:
- backend:
uv run uvicorn app:app --reload --host 127.0.0.1 --port 8123 - web: Vite in
apps/web - convex:
convex devinapps/convex
You can also run them separately:
bun run backend:dev
bun run web:dev
bun run convex:devBackend dev server:
bun run backend:devBackend tests:
bun run backend:testBackend lint:
bun run backend:lintFrontend build:
bun run web:buildDATABASE_URI is the main backend persistence setting.
It is used for:
- LangGraph checkpoint/store persistence
- rerAI thread metadata
- rerAI run metadata
- persisted SSE replay events
Supported values:
- local SQLite, for example
sqlite:///tmp/rerai-backend.db - Postgres, including Supabase
If LANGGRAPH_SETUP_DB=true, startup will create both LangGraph tables and rerAI metadata tables.
Deploy apps/backend as a dedicated Railway service using its Dockerfile.
Expected production pattern:
- frontend calls the backend directly for LangGraph/SSE traffic
- backend validates Convex bearer tokens and checks thread ownership through Convex
- Convex remains the identity and app-data service
Deploy apps/web to a static host. The recommended default is Cloudflare Pages.
Production web env vars:
VITE_CONVEX_URLVITE_BACKEND_URL
The frontend does not need Google OAuth secrets or backend secrets. It only needs the public Convex URLs.
Google OAuth is handled by Convex Auth, not by the frontend host.
Set these on the Convex deployment:
AUTH_GOOGLE_IDAUTH_GOOGLE_SECRET
The Google OAuth redirect URI must point at the Convex Site domain:
https://<your-convex-site>.convex.site/api/auth/callback/google
Deploy apps/convex with:
bun run convex:deployProduction Convex env vars include:
AUTH_GOOGLE_IDAUTH_GOOGLE_SECRET
- The backend is managed by
uv, not by Bun workspaces. - The frontend calls the backend directly for LangGraph-compatible traffic.
- The backend preserves the existing LangGraph-compatible API surface needed by the app, but it no longer depends on hosted Agent Server infrastructure.
- backend runtime and deployment details: apps/backend/README.md
- backend-facing Convex auth/thread checks: apps/convex/convex/backend.ts