Design Documentation
This directory describes the implemented architecture of OpenAlgo 2.0.1.7. OpenAlgo is a self-hosted, single-user trading application with a Flask/Flask-RESTX backend, React 19 frontend, broker plugins, a separate WebSocket proxy, sandbox execution, hosted strategies, Flow automation, portfolio analytics, chart trading, and optional local or remote MCP access.
The current plugin inventory contains 35 broker directories with plugin.json. Broker capabilities are metadata-driven; a plugin's presence does not imply every optional broker operation is supported.
Documentation Policy
Code and registered routes are authoritative when a design document conflicts with an example.
The public REST contract lives in the API documentation.
Flask-RESTX Swagger/OpenAPI UI is intentionally disabled with
doc=Falseinrestx_api/__init__.py. Do not advertise or re-enable/api/docsas part of documentation maintenance.These pages describe implemented behavior verified against the application code and registered routes.
Runtime And Core Architecture
Current repository boundaries and ownership
React 19, Vite 8, routing, state, data access
Flask factory, route layers, services, background work
In-process caches and invalidation behavior
HTTP and market-data connection reuse
SQLite and DuckDB stores, NullPool, teardown
Local conventions and architectural constraints
Route-to-service-to-broker boundaries
Shared auth, config, logging, networking helpers
Validation, registration, initialization, server startup
Per-process async side-effect dispatch
Authentication And Security
App auth, TOTP, broker selection, session resume
Keys, encryption, CSRF, CORS, CSP, middleware
IP extraction, bans, proxy trust
Cookies, CSRF, CSP, hardening headers
Daily expiry, heartbeat, reconnect, multi-session behavior
Mail configuration and diagnostics
Reset flow and password change revocation
Per-purpose two-factor policy
Trading, Data, And Automation
Proxy protocol, ZMQ fan-in, adapters, subscriptions
Analyzer execution engine and isolated state
DuckDB historical-data subsystem
Registered v1 architecture; Swagger intentionally disabled
Visual workflow storage and execution
Scanner automation
JSON integration surfaces
Validation, mode routing, Action Center, broker calls
Broker instrument downloads and cache policy
Plugin module convention
Hosted-process model and logs
Webhook strategy management
Semi-auto order approval
Keyboard trading, charts, persisted stops, risk monitor
Read-only backtesting and current-holdings scenario analysis
UI, Tools, And Integrations
Current React pages and analytics tools
API key management and WebSocket tester
Local stdio and opt-in remote OAuth transport
Bot lifecycle, commands, automatic and explicit alerts
Browser notification categories
Live P&L charting
Contract and underlying search
Theme and accent persistence
Environment and broker configuration boundaries
WebSocket adapter construction
Operations And Deployment
Container build and compose runtime
Host deployment
Python logs and file retention
Runtime and Remote MCP administration
Order and analyzer log views
API timing data
Request telemetry and ban support
.env contract
Tunnel management
Upgrade and backup flow
Local checks and CI coverage
Limiter configuration and endpoint classes
Last updated