stock-bot/apps/stock/web-app
Boki 4cd6038063 refactor: pre-M0 cleanup, core library hardening, and isolated dev/QA Docker stack
- Remove ~44k LOC of dead code, legacy v1 TS simulator/strategy stack, event-bus, analytics FastAPI prototype, legacy calculation archives, and unused deps (data-ingestion provider API handlers untouched)
- Extract @stock-bot/di/http-security and isolate @stock-bot/browser to data-ingestion via ServiceContainerBuilder.withRegistrations()
- Harden @stock-bot/mongodb read-only proxies, flatten @stock-bot/postgres with unified master+research migrations, and fix @stock-bot/config EnvLoader, ServiceApplication worker lifecycle, NamespacedCache.clear(), and BatchProcessor error propagation
- Flatten workspace root (remove apps/stock/package.json) and collapse orchestrator re-export shims
- Pin all Docker image versions, add shm_size/nofile/RAM caps and docker-compose.quant.yml, fix 05-add-visible-column.sql view recreation, and decouple dev/QA Compose project names for side-by-side execution
- Update PLATFORM-PLAN, DATA-CONTRACTS (bars_1m PARTITION BY MONTH, Rust bulk ETL, DuckDB limits), MILESTONES, and servers docs
2026-11-27 00:11:50 -05:00
..
public refactored monorepo for more projects 2025-06-22 23:48:01 -04:00
src refactor: pre-M0 cleanup, core library hardening, and isolated dev/QA Docker stack 2026-11-27 00:11:50 -05:00
.env fix(web): stabilize local sign-in and page lifecycle handling 2026-10-25 11:31:42 -04:00
.env.example fix(web): stabilize local sign-in and page lifecycle handling 2026-10-25 11:31:42 -04:00
eslint.config.js refactored monorepo for more projects 2025-06-22 23:48:01 -04:00
index.html refactored monorepo for more projects 2025-06-22 23:48:01 -04:00
package.json refactor: pre-M0 cleanup, core library hardening, and isolated dev/QA Docker stack 2026-11-27 00:11:50 -05:00
postcss.config.js refactored monorepo for more projects 2025-06-22 23:48:01 -04:00
README.md refactor: share research domain and simplify application workflows 2026-10-26 15:29:43 -04:00
tailwind.config.js refactored monorepo for more projects 2025-06-22 23:48:01 -04:00
tsconfig.json work on spider for te 2025-07-06 15:26:47 -04:00
tsconfig.node.json refactored monorepo for more projects 2025-06-22 23:48:01 -04:00
vite.config.ts fix(web): stabilize local sign-in and page lifecycle handling 2026-10-25 11:31:42 -04:00

Stock Bot research workbench

For the complete local research stack, run bun run infra:up then bun run dev:research from the repository root after the initial build. The API, orchestrator and browser use ports 2003, 2004 and 5173. This preserves existing data and does not activate trading.

The React application is the primary interface for strategy versions, reproducible backtests, experiments and evidence-linked research. It consumes the TypeScript web API; the authoritative financial simulation runs in Rust behind the orchestrator.

For the whole system, start with Understanding Stock Bot and the backtest walkthrough.

Product areas

Route What is connected
/strategies Strategy families, immutable versions, parameter forms and candidate publication/review.
/backtests Saved configurations, retained dataset selection, durable runs, cancellation, results and reproduction. A saved run has its own reopenable URL.
/experiments Parameter trials, comparison, chronological validation, walk-forward studies and cost sensitivity.
/research Projects, hypotheses, findings and supporting evidence; research-agent grants and budgets have a separate page.
/paper Human review and management of paper deployments. Creating a deployment does not activate it.
/symbols, /exchanges Market catalog and symbol data views.
/dashboard, /system/monitoring, /system/pipeline Existing overview and operational views.

/portfolio, /analytics and /settings are currently placeholders. Implemented research charts and metrics live inside run and experiment views. New canonical runs currently admit one asset and one execution series; legacy results keep their qualification labels.

Source map

Location Purpose
src/app/App.tsx Authentication wrapper and complete route map.
src/features Each workflow's pages, components, hooks and API functions. Start with backtest/ to follow a run.
src/components Shared layout, buttons, dialogs, tables and chart components.
src/lib/api.ts Common API origin and cookie-authenticated request helper.
src/app/AuthGate.tsx Browser authentication flow.

The UI renders saved financial results and sends configuration changes. It does not calculate competing fill, cash or position semantics. PostgreSQL-backed API responses own run status; WebSocket updates prompt refreshes.

Local development

Install and build the workspace from the repository root as described in the root README. From this directory:

bun run dev
bun run build
bun run preview
bun run type-check

These start Vite development, build static assets, preview a build, and check frontend types respectively; run the command you need. React, TypeScript, Vite, Tailwind, Headless UI and Recharts are the main UI dependencies. See package.json for scripts and pinned ranges.

Vite is configured for 127.0.0.1:5173, with a fixed port so it cannot silently move to an origin the API does not allow. Port 3000 belongs to Grafana in the Docker stack. Open http://localhost:5173 or http://127.0.0.1:5173. The API origin is VITE_API_BASE_URL when supplied; the checked-in value is blank, so development follows the browser's hostname on port 2003, and production uses the page's own origin. This keeps the session cookie on the same hostname: mixing 127.0.0.1 and localhost can prevent sign-in from persisting. Restart Vite after changing environment configuration. The dev server has no configured API proxy. The backend must be running and allow the frontend origin for authenticated cross-origin requests.

Browser authentication uses HttpOnly session cookies. VITE_API_BASE_URL is a public address, not a place for service credentials. Research runs also need the orchestrator and its configured infrastructure; starting Vite alone supplies the interface only.

Tests and behavior

The workbench browser test exercises the authenticated API and durable workflow using disposable infrastructure. Canonical workbench tests cover retained-input configuration and results. Follow the root test setup for prerequisites rather than using a regular trading database as a test fixture.

Keep loading, empty, failed, cancelled and completed states distinct. Reopening a saved run should read the recorded result, not silently start a new simulation.

Primary navigation lists implemented workflows. Standalone Portfolio, Analytics and Settings remain unavailable at their existing URLs and are hidden from the menu. Saved backtest and experiment pages continue to provide performance, trade and risk analysis.