Conversation
Show the request flow from HTTP clients through middleware layers (CORS, logging, error handling, rate limiting, auth) into the router endpoints, the shared MT5 client singleton, and down to the MetaTrader 5 terminal via pdmt5. https://claude.ai/code/session_01YNwrPB3iN3JWpkVgM5XwVQ
Collapse the middleware chain and seven routers into single summary nodes to reduce diagram verbosity while keeping the key layers visible. https://claude.ai/code/session_01YNwrPB3iN3JWpkVgM5XwVQ
660766d to
22d37a7
Compare
There was a problem hiding this comment.
Architecture Diagram Review
Nice addition — the diagram is clear, well-placed, and accurately reflects the router and dependency structure. A few observations:
Auth is not middleware
"Auth" is listed in the middleware stack, but authentication is implemented as a FastAPI dependency (Security(api_key_header) + verify_api_key in auth.py), not as middleware. The actual middleware registered in middleware.py and main.py is: CORSMiddleware, SlowAPIMiddleware (rate limiter), error_handler_middleware, and logging_middleware. Listing "Auth" alongside these implies it runs on every request as a middleware layer, when it is actually opt-in per endpoint. Consider removing it from the middleware node or moving it closer to the routers.
Minor: Two distinct concerns in one node
MT5 Client Singleton + JSON/Parquet Formatter bundles dependencies.py and formatters.py — separate modules with different responsibilities — into a single box. Splitting them or relabeling would be more precise, though acceptable at this level of abstraction.
Minor: Response path bypasses middleware
The return arrow Deps -- "JSON / Parquet" --> Client skips the middleware stack, which in practice processes responses too (CORS headers, logging, error handling). This is a common simplification — just noting it for accuracy.
Overall this is a useful diagram that matches the codebase well. The auth point is worth addressing; the rest are optional refinements.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Added a comprehensive Mermaid architecture diagram to the README that visualizes the system structure and data flow of the MetaTrader 5 API server.
Key Changes
Implementation Details
https://claude.ai/code/session_01YNwrPB3iN3JWpkVgM5XwVQ