Files
MyClub/diagrams/backend-middleware-pipeline.mmd
T
Tomas Dvorak c941313fd5 dev day #92
2025-11-14 15:53:12 +01:00

65 lines
2.0 KiB
Plaintext

%%{init: {
'theme': 'base',
'flowchart': { 'curve': 'linear' },
'themeCSS': '.edgePath path { stroke-dasharray: 6 4; animation: dash 18s linear infinite; } @keyframes dash { to { stroke-dashoffset: -1000; } } .cluster rect { rx:8; ry:8; }'
}}%%
flowchart TB
classDef stage fill:#f1f5f9,stroke:#475569,color:#0f172a;
classDef mid fill:#ecfeff,stroke:#0891b2,color:#0e7490;
classDef api fill:#eef2ff,stroke:#6366f1,color:#312e81;
classDef route fill:#ede9fe,stroke:#7c3aed,color:#4c1d95;
classDef stat fill:#e2e8f0,stroke:#334155,color:#0f172a;
subgraph req["HTTP Request Pipeline"]
direction TB
client["Client"]:::stage
router["Gin Router"]:::stage
m_reqid["RequestID"]:::mid
m_logger["RequestLogger"]:::mid
m_recovery["CustomRecoveryWithReporter"]:::mid
m_errstatus["ErrorStatusReporter"]:::mid
m_sanitize["SanitizeHeaders"]:::mid
m_dbctx["DBContext (with timeout)"]:::mid
m_size["RequestSizeLimit (2MB)"]:::mid
m_ct["ValidateContentType (JSON for mutating)"]:::mid
m_sec["SecurityHeaders"]:::mid
m_assets["AssetCacheControl"]:::mid
m_cors["CORS Handler (reflect allowed origins)"]:::mid
client --> router
router --> m_reqid --> m_logger --> m_recovery --> m_errstatus --> m_sanitize --> m_dbctx --> m_size --> m_ct --> m_sec --> m_assets --> m_cors
end
subgraph endpoints["Endpoints"]
direction TB
api_v1["/api/v1"]:::api
root["/robots.txt, /sitemap.xml, /s/:code, /r"]:::api
subgraph groups["API Groups"]
direction TB
g_public["Public"]:::route
g_protected["Protected (JWTAuth + CSRF)"]:::route
g_admin["Admin (Role: admin)"]:::route
end
m_cors --> api_v1
m_cors --> root
api_v1 --> g_public --> g_protected --> g_admin
end
subgraph static["Static & Assets"]
direction TB
s_cache["/cache -> ./cache"]:::stat
s_uploads["/uploads -> UPLOAD_DIR"]:::stat
s_dist["/dist -> ./static"]:::stat
s_prem["/premium-assets -> ./pro"]:::stat
s_metrics["/metrics (prometheus)"]:::stat
end
m_cors --> s_cache
m_cors --> s_uploads
m_cors --> s_dist
m_cors --> s_prem
m_cors --> s_metrics