Skip to content

feat: monorepo rebuild with streaming chat, Convex auth, FastAPI backend, and recovery UI - #4

Merged
parthashirolkar merged 13 commits into
mainfrom
feat/monorepo-webapp
Apr 24, 2026
Merged

feat: monorepo rebuild with streaming chat, Convex auth, FastAPI backend, and recovery UI#4
parthashirolkar merged 13 commits into
mainfrom
feat/monorepo-webapp

Conversation

@parthashirolkar

Copy link
Copy Markdown
Owner

Summary

This PR represents a full rebuild of rerAI from a single Python script into a production-grade monorepo with three integrated apps: a Python FastAPI backend, a React frontend, and a Convex backend-as-a-service.

What Changed

1. Monorepo Structure (d6bc5f8)

  • Split project into apps/backend, apps/web, and apps/convex workspaces
  • Root-level bun workspace management with shared tooling

2. React Frontend (ee41bae, f4524be, 2100657, fe9c2bf)

  • Built with Vite, React, TypeScript, Tailwind CSS, shadcn/ui
  • Streaming chat with live markdown rendering and thinking indicators
  • Resizable sidebar with conversation history, search, and persisted state
  • Muted green theme with accessible contrast
  • Fixed-height app shell — only the transcript scrolls; header/sidebar/composer remain fixed
  • Accessible sidebar delete buttons (visible on hover/focus)
  • Error boundary with recovery UI to start a blank chat on crashes

3. Convex Backend (41c902c, 01f79d5)

  • Full auth integration (OAuth via Google)
  • Persisted chat threads, messages, and user preferences
  • LangGraph proxy with thread/run state management
  • Real-time message syncing via Convex queries

4. FastAPI Backend (b56131c, 4bcb1eb, db9373e)

  • New FastAPI app (rerai_api) exposing LangGraph via SSE streaming endpoints
  • Internal JWT auth for Convex → backend communication
  • Dockerfile + Railway deployment config (railway.json) with healthchecks
  • All tools migrated: GIS, regulatory, RERA, transit, geo, permit feasibility

5. Agent Architecture (53f9420)

  • Removed default HITL interrupts from tool calls — the agent now runs autonomously
  • Optional interrupt_on still available for future high-risk tools
  • Hardened InterruptDialog with closeable UI, dismiss-to-restart, and payload normalization
  • Extracted interruptHelpers.ts for pure, testable interrupt handling

6. Testing & Quality

  • Backend: test_fastapi_backend.py (graph construction, interrupt serialization)
  • Frontend: ErrorBoundary.test.tsx, InterruptDialog.test.ts, messages.test.ts
  • Ruff linting/formatting for Python
  • tsc -b --noEmit clean for TypeScript

Deployment

  • Backend deployed to Railway (langgraph-backend service)
  • Frontend deployed to Cloudflare Pages (linked to this repo/branch)
  • Convex project handles auth and data

Commits

d6bc5f8 refactor: split the project into app workspaces
ee41bae feat: rebuild web app with streaming chat, resizable sidebar, muted green theme
41c902c Add Convex auth and persisted chat state
b56131c feat: add FastAPI backend and LangGraph proxy
4bcb1eb Add internal auth for FastAPI backend proxy
db9373e Fix Railway backend deployment config
01f79d5 Fix Convex typings for frontend deploy
f4524be Fix LangGraph chat stream rendering
2100657 Default signed-in users to a blank chat
53f9420 Remove HITL interrupts from tool calls and add recovery UI
fe9c2bf Fix chat layout: fixed-height shell, transcript-only scroll, and accessible sidebar delete

…reen theme

- Replace simple form-based chat with full streaming UI using @langchain/react useStream
- Add resizable sidebar with drag handle (200-400px range) and thread history management
- Apply muted green 'Moss & Stone' theme palette across all tokens (hue ~152-155°)
- Add fancy Composer with animated expansion, green glow, and border-radius morph on multiline
- Add Transcript, ReportPanel, InterruptDialog, MarkdownContent components
- Migrate from Tailwind v3 to v4 with CSS-native config, add shadcn/ui (New York style)
- Switch LLM to nvidia/nemotron-3-super-120b-a12b:free and enable streaming on both models
- Remove redundant header 'New' button, add subtle atmospheric radial gradients to body
Translate React SDK messages-tuple stream requests to the Python LangGraph messages mode while preserving values streaming for final state handoff. Normalize raw LangChain message chunk tuples into messages SSE events so @langchain/react can render live assistant output.

Persist assistant responses from the authoritative final thread state in the web client, falling back to live stream messages only when final state messages are unavailable. Decouple run idle cleanup from Convex assistant-message sync failures so completed runs do not remain stuck in a thinking state.

Add async persisted graph construction for the FastAPI runtime, including async SQLite/Postgres checkpointers and stores, and return clear 503 responses when state or history endpoints are unavailable because persistence is disabled.

Harden Convex LangGraph thread authorization by returning a structured 403 through the proxy and allowing the web app to detach invalid LangGraph thread links. Add focused backend and frontend coverage for stream protocol handling, LangChain message serialization, final-state message extraction, and persistence-disabled state/history behavior.
Stop auto-opening the last or first saved thread during authenticated app hydration. Clear persisted LangGraph thread/run IDs on startup so a stale or half-finished conversation cannot blank the app before the user chooses it.

Keep existing conversations selectable from the sidebar, make the new-chat action return to an empty conversation, and fall back to the blank state when a selected thread is deleted or disappears.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 24, 2026

Copy link
Copy Markdown

Deploying rerai with  Cloudflare Pages  Cloudflare Pages

Latest commit: 864790d
Status: ✅  Deploy successful!
Preview URL: https://58dcb7a7.rerai.pages.dev

View logs

@parthashirolkar
parthashirolkar merged commit f78d5f2 into main Apr 24, 2026
1 check passed
@parthashirolkar
parthashirolkar deleted the feat/monorepo-webapp branch April 24, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant