Skip to main content

alphaswarm_client — Vite operator UI

Doc map: alphaswarm_docs/index.md · API surface: alphaswarm_docs/architecture.md#system-component-diagram.

Update: the webui/ Next.js app this page used to describe has been cut over and retired. alphaswarm_client/ (Vite + Tailwind + shadcn/ui) is now the active, primary local operator UI; it talks to the FastAPI backend on :8000 over REST + WebSocket. The legacy Solara UI (alphaswarm.ui.app, :8765) is deprecated and kept only as a /legacy rollback surface. A separate sibling repo, alphaswarm_ui/ (Next.js 14, Ant Design), is the authenticated multi-tenant hosted dashboard (app.alpha-swarm.ai) — a different product, not a replacement for the local operator UI.

Stack​

  • Vite 7 + React 19 + TypeScript, Tailwind 4 + shadcn/ui (Radix primitives)
  • AG Grid (ag-grid-community + ag-grid-react)
  • React Flow v12 (@xyflow/react) for visual workflow editors
  • recharts + echarts-for-react for charts
  • TanStack Query v5 + Zustand
  • openapi-typescript + openapi-fetch for type-safe REST access

The full directory layout and design rationale live in alphaswarm_client/README.md / alphaswarm_client/AGENTS.md.

Local dev​

From alphaswarm_client/:

pnpm install
pnpm run gen:api # regenerate the typed OpenAPI client
pnpm dev # start the Vite dev server on :3001

In docker compose, the frontend service (built from alphaswarm_client/Dockerfile) is published on hosts :3000 and :3002 (container port :8080); the retired Next.js webui no longer owns a compose service.

Backend contract additions​

The refactor added or extended a small surface on the FastAPI side:

  • GET /auth/whoami — local-first identity stub
  • GET /chat/threads, POST /chat/threads, DELETE /chat/threads/{id}
  • POST /chat accepts an optional context: ChatContext block (page, vt_symbol, backtest_id, strategy_id, …) which is materialised into the system prompt so the assistant knows which page the user is on.
  • CORS is now driven by ALPHASWARM_WEBUI_CORS_ORIGINS (comma-separated list). Empty value falls back to the legacy "*" behaviour.

WebSocket contracts are unchanged:

  • WS /chat/stream/{task_id} — Celery task progress
  • WS /live/stream/{channel_id} — live market subscriptions

OpenAPI client regeneration​

alphaswarm_client consumes a generated paths interface that mirrors FastAPI's spec exactly:

  1. python -m scripts.export_openapi --out data/openapi.json
  2. pnpm --dir alphaswarm_client run gen:api (runs openapi-typescript ../data/openapi.json -o src/lib/api/generated/schema.d.ts)

CI should run both and fail if the diff is non-empty (drift check).

Migration history​

The cutover from the legacy Next.js webui/ app to alphaswarm_client (Vite + Tailwind + shadcn) is complete: alphaswarm_client is the only operator UI. The ui (Solara, :8765) compose service is kept only for emergency rollback to the /legacy surface; the Next.js webui app no longer owns a compose service at all. See alphaswarm_client/CUTOVER.md for the full history and rollback procedure.

Page tree (top-level, alphaswarm_client/src/routes/)​