Skip to content

Add architecture diagram to README#19

Merged
dceoy merged 3 commits intomainfrom
claude/add-architecture-diagram-Y4rVH
Mar 17, 2026
Merged

Add architecture diagram to README#19
dceoy merged 3 commits intomainfrom
claude/add-architecture-diagram-Y4rVH

Conversation

@dceoy
Copy link
Copy Markdown
Owner

@dceoy dceoy commented Mar 17, 2026

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

  • Added "Architecture" section with a detailed Mermaid flowchart diagram showing:
    • HTTP client connection from any OS
    • Windows host environment containing the FastAPI application
    • Middleware stack (CORS, Logging, Error Handler, Rate Limiter, API Key Auth)
    • Seven router modules (health, symbols, market, account, history, calc, trading) with their respective endpoints
    • Shared dependencies module with MT5 client singleton
    • Data formatters (JSON/Parquet) for response serialization
    • Integration with pdmt5 library and MetaTrader 5 terminal
    • Request/response flow between client and server components

Implementation Details

  • The diagram uses a hierarchical graph structure to clearly separate concerns
  • Shows the middleware pipeline and how requests flow through authentication before reaching routers
  • Illustrates how all routers depend on a centralized MT5 client singleton
  • Demonstrates the complete data path from HTTP client through the application stack to the MetaTrader 5 terminal and back

https://claude.ai/code/session_01YNwrPB3iN3JWpkVgM5XwVQ

claude added 2 commits March 17, 2026 12:23
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
@dceoy dceoy force-pushed the claude/add-architecture-diagram-Y4rVH branch from 660766d to 22d37a7 Compare March 17, 2026 12:54
@dceoy dceoy self-assigned this Mar 17, 2026
@dceoy dceoy marked this pull request as ready for review March 17, 2026 12:55
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@dceoy dceoy merged commit aed0d86 into main Mar 17, 2026
5 checks passed
@dceoy dceoy deleted the claude/add-architecture-diagram-Y4rVH branch March 17, 2026 13:54
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.

2 participants