rusty-mermaid Gallery

25 diagram types — 297 diagrams rendered by rusty-mermaid

flowchart (122)

[Part 1] Part 2 Part 3
all_shapes
Rectangle Rounded Rect Stadium Shape Diamond Circle Hexagon Parallelogram Alt Parallelogram Trapezoid Alt Trapezoid Double Circle Subroutine Cylinder Asymmetric
Source (.mmd)
flowchart TD
    rect[Rectangle] --> rounded(Rounded Rect)
    rounded --> stadium([Stadium Shape])
    stadium --> diamond{Diamond}
    diamond --> circle((Circle))
    circle --> hex{{Hexagon}}
    hex --> para[/Parallelogram/]
    para --> paraAlt[\Alt Parallelogram\]
    paraAlt --> trap[/Trapezoid\]
    trap --> trapAlt[\Alt Trapezoid/]
    trapAlt --> dblCircle(((Double Circle)))
    dblCircle --> sub[[Subroutine]]
    sub --> cyl[(Cylinder)]
    cyl --> asym>Asymmetric]
arch_api_gateway
API Gateway Clients Cross-Cutting Backend Services allowed open closed closed closed closed closed denied Web Application Mobile App Partner API Webhook Callers Rate Limiter Authentication Authorization Request Transform Route Matcher Circuit Breaker Response Cache User Service Product Service Order Service Search Service Upload Service Webhook Receiver JWT Validator API Key Store RBAC Policies Audit Log Distributed Tracing Metrics Collector
Source (.mmd)
graph TD
    subgraph Clients
        WebApp[Web Application]
        MobileApp[Mobile App]
        Partner[Partner API]
        Webhook[Webhook Callers]
    end

    subgraph API Gateway
        RateLimit{Rate Limiter}
        AuthN[Authentication]
        AuthZ{Authorization}
        Transform[Request Transform]
        Router[Route Matcher]
        CircuitBreak{Circuit Breaker}
        ResponseCache[Response Cache]
    end

    subgraph Backend Services
        UserSvc[User Service]
        ProductSvc[Product Service]
        OrderSvc[Order Service]
        SearchSvc[Search Service]
        UploadSvc[Upload Service]
        WebhookSvc[Webhook Receiver]
    end

    subgraph Cross-Cutting
        JWT[JWT Validator]
        APIKey[API Key Store]
        RBAC[(RBAC Policies)]
        Audit[Audit Log]
        Tracing[Distributed Tracing]
        Metrics[Metrics Collector]
    end

    WebApp --> RateLimit
    MobileApp --> RateLimit
    Partner --> RateLimit
    Webhook --> WebhookSvc
    RateLimit --> AuthN
    AuthN --> JWT
    AuthN --> APIKey
    AuthN --> AuthZ
    AuthZ --> RBAC
    AuthZ -->|denied| WebApp
    AuthZ -->|allowed| Transform
    Transform --> Router
    Router --> CircuitBreak
    CircuitBreak -->|open| ResponseCache
    CircuitBreak -->|closed| UserSvc
    CircuitBreak -->|closed| ProductSvc
    CircuitBreak -->|closed| OrderSvc
    CircuitBreak -->|closed| SearchSvc
    CircuitBreak -->|closed| UploadSvc
    Router -.-> Audit
    Router -.-> Tracing
    Router -.-> Metrics
    UserSvc -.-> Tracing
    ProductSvc -.-> Tracing
    OrderSvc -.-> Tracing
arch_auth_flow
No Yes Password OAuth SSO Passkey Yes No Yes Yes Yes No Yes Yes Expired Invalid Valid No Yes No Yes No No No No User Request Has JWT? Login Page JWT Valid? Auth Method Email + Password OAuth Provider SAML IdP WebAuthn Challenge Credentials OK? MFA Enabled? OAuth Callback Account Linked? Create Account SAML Assertion Valid Assertion? Passkey Valid? Issue JWT + Refresh TOTP / SMS Code Code Valid? Has Refresh Token? Has Permission? Rotate Tokens 403 Forbidden Proceed to Resource
Source (.mmd)
flowchart TD
    Start[User Request] --> HasToken{Has JWT?}

    HasToken -->|No| LoginPage[Login Page]
    HasToken -->|Yes| ValidateJWT{JWT Valid?}

    LoginPage --> ChooseMethod{Auth Method}
    ChooseMethod -->|Password| PasswordForm[Email + Password]
    ChooseMethod -->|OAuth| OAuthRedirect[OAuth Provider]
    ChooseMethod -->|SSO| SAMLRedirect[SAML IdP]
    ChooseMethod -->|Passkey| WebAuthn[WebAuthn Challenge]

    PasswordForm --> CheckCreds{Credentials OK?}
    CheckCreds -->|No| LoginPage
    CheckCreds -->|Yes| MFACheck{MFA Enabled?}

    OAuthRedirect --> OAuthCallback[OAuth Callback]
    OAuthCallback --> LinkAccount{Account Linked?}
    LinkAccount -->|No| CreateAccount[Create Account]
    LinkAccount -->|Yes| MFACheck
    CreateAccount --> MFACheck

    SAMLRedirect --> SAMLAssert[SAML Assertion]
    SAMLAssert --> ValidateSAML{Valid Assertion?}
    ValidateSAML -->|No| LoginPage
    ValidateSAML -->|Yes| MFACheck

    WebAuthn --> VerifyPasskey{Passkey Valid?}
    VerifyPasskey -->|No| LoginPage
    VerifyPasskey -->|Yes| IssueTokens

    MFACheck -->|No| IssueTokens[Issue JWT + Refresh]
    MFACheck -->|Yes| MFAPrompt[TOTP / SMS Code]
    MFAPrompt --> VerifyMFA{Code Valid?}
    VerifyMFA -->|No| MFAPrompt
    VerifyMFA -->|Yes| IssueTokens

    ValidateJWT -->|Expired| RefreshFlow{Has Refresh Token?}
    ValidateJWT -->|Invalid| LoginPage
    ValidateJWT -->|Valid| CheckPerms{Has Permission?}

    RefreshFlow -->|No| LoginPage
    RefreshFlow -->|Yes| RotateTokens[Rotate Tokens]
    RotateTokens --> CheckPerms

    CheckPerms -->|No| Forbidden[403 Forbidden]
    CheckPerms -->|Yes| Authorized[Proceed to Resource]
arch_caching_layers
Invalidation Hit Miss Hit Miss Hit Miss Hit Miss Hit Miss Client Browser CDN Cache Hit? Serve from CDN App Load Balancer L1 In-Memory? Serve from Memory L2 Redis? Serve from Redis Session Cache? Serve Session Query Cache? Serve Cached Query Database Query Connection Pool PostgreSQL Primary Read Replica Hydrate Response Write to Redis Write to Memory Return Response Webhook Trigger TTL Expiry Write-Through Redis Pub/Sub CDN Purge
Source (.mmd)
flowchart TD
    Client[Client Browser] --> CDNCheck{CDN Cache Hit?}

    CDNCheck -->|Hit| CDNResp[Serve from CDN]
    CDNCheck -->|Miss| AppLB[App Load Balancer]

    AppLB --> L1Check{L1 In-Memory?}
    L1Check -->|Hit| L1Resp[Serve from Memory]
    L1Check -->|Miss| L2Check{L2 Redis?}

    L2Check -->|Hit| L2Resp[Serve from Redis]
    L2Check -->|Miss| SessionCheck{Session Cache?}

    SessionCheck -->|Hit| SessionResp[Serve Session]
    SessionCheck -->|Miss| QueryCheck{Query Cache?}

    QueryCheck -->|Hit| QueryResp[Serve Cached Query]
    QueryCheck -->|Miss| DBQuery[Database Query]

    DBQuery --> PGPool[Connection Pool]
    PGPool --> PGPrimary[(PostgreSQL Primary)]
    PGPool --> PGReplica[(Read Replica)]

    DBQuery --> Hydrate[Hydrate Response]
    Hydrate --> WriteL2[Write to Redis]
    WriteL2 --> WriteL1[Write to Memory]
    WriteL1 --> Response[Return Response]

    subgraph Invalidation
        WebhookInv[Webhook Trigger]
        TTLExpiry[TTL Expiry]
        WriteThrough[Write-Through]
        PubSub[Redis Pub/Sub]
    end

    WebhookInv -.-> CDNPurge[CDN Purge]
    TTLExpiry -.-> L1Check
    TTLExpiry -.-> L2Check
    WriteThrough -.-> PGPrimary
    WriteThrough -.-> WriteL2
    PubSub -.-> L1Check
arch_cicd_pipeline
CD CI Staging Production Source Observe Checks Build push webhook approved rejected yes no Developer GitHub Repo Pull Request Lint + Format Type Check Unit Tests Integration Tests Security Scan License Audit Docker Build Push to ECR Artifact Archive Deploy Staging Smoke Tests Load Test Manual Approval Canary 10% Health OK? Full Rollout Rollback Metrics Dashboard Alert Rules Log Aggregation Slack Notify
Source (.mmd)
graph LR
    subgraph Source
        Dev[Developer]
        Git[GitHub Repo]
        PR{Pull Request}
    end

    subgraph CI
        subgraph Checks
            Lint[Lint + Format]
            TypeCheck[Type Check]
            UnitTest[Unit Tests]
            IntegTest[Integration Tests]
            SecurityScan[Security Scan]
            LicenseCheck[License Audit]
        end
        subgraph Build
            DockerBuild[Docker Build]
            DockerPush[Push to ECR]
            ArtifactStore[Artifact Archive]
        end
    end

    subgraph CD
        subgraph Staging
            DeployStg[Deploy Staging]
            SmokeTest[Smoke Tests]
            PerfTest[Load Test]
            ApprovalStg{Manual Approval}
        end
        subgraph Production
            CanaryDeploy[Canary 10%]
            CanaryCheck{Health OK?}
            FullRollout[Full Rollout]
            Rollback[Rollback]
        end
    end

    subgraph Observe
        Metrics[Metrics Dashboard]
        Alerts[Alert Rules]
        Logs[Log Aggregation]
        SlackNotify[Slack Notify]
    end

    Dev -->|push| Git
    Git -->|webhook| PR
    PR --> Lint
    PR --> TypeCheck
    PR --> SecurityScan
    PR --> LicenseCheck
    Lint --> UnitTest
    TypeCheck --> UnitTest
    UnitTest --> IntegTest
    IntegTest --> DockerBuild
    SecurityScan --> DockerBuild
    DockerBuild --> DockerPush
    DockerBuild --> ArtifactStore
    DockerPush --> DeployStg
    DeployStg --> SmokeTest
    SmokeTest --> PerfTest
    PerfTest --> ApprovalStg
    ApprovalStg -->|approved| CanaryDeploy
    ApprovalStg -->|rejected| SlackNotify
    CanaryDeploy --> CanaryCheck
    CanaryCheck -->|yes| FullRollout
    CanaryCheck -->|no| Rollback
    FullRollout -.-> Metrics
    FullRollout -.-> Alerts
    FullRollout -.-> Logs
    Rollback -.-> SlackNotify
    Alerts -.-> SlackNotify
arch_cloud_aws
VPC AWS Services Private Subnet A Edge Private Subnet B Public Subnet Internet Users Route 53 CloudFront S3 Static Assets AWS WAF Application LB NAT Gateway Bastion Host ECS Fargate - API ECS Fargate - Worker Lambda - Auth Lambda - Resize RDS PostgreSQL RDS Read Replica ElastiCache Redis OpenSearch SQS Queue SNS Topics SES Email S3 Data Bucket DynamoDB Sessions Secrets Manager CloudWatch
Source (.mmd)
graph TD
    subgraph Internet
        Users[Users]
        DNS[Route 53]
    end

    subgraph Edge
        CF[CloudFront]
        S3Static[S3 Static Assets]
        WAF{AWS WAF}
    end

    subgraph VPC
        subgraph Public Subnet
            ALB[Application LB]
            NAT[NAT Gateway]
            Bastion[Bastion Host]
        end
        subgraph Private Subnet A
            ECS1[ECS Fargate - API]
            ECS2[ECS Fargate - Worker]
            Lambda1[Lambda - Auth]
            Lambda2[Lambda - Resize]
        end
        subgraph Private Subnet B
            RDS[(RDS PostgreSQL)]
            RDSReplica[(RDS Read Replica)]
            Redis[(ElastiCache Redis)]
            ES[(OpenSearch)]
        end
    end

    subgraph AWS Services
        SQS[SQS Queue]
        SNS[SNS Topics]
        SES[SES Email]
        S3Data[S3 Data Bucket]
        DynamoDB[(DynamoDB Sessions)]
        Secrets[Secrets Manager]
        CW[CloudWatch]
    end

    Users --> DNS
    DNS --> CF
    CF --> S3Static
    CF --> WAF
    WAF --> ALB
    ALB --> ECS1
    ALB --> Lambda1
    ECS1 --> RDS
    ECS1 --> RDSReplica
    ECS1 --> Redis
    ECS1 --> ES
    ECS1 --> DynamoDB
    ECS1 --> Secrets
    ECS1 -.-> SQS
    SQS -.-> ECS2
    ECS2 --> RDS
    ECS2 --> S3Data
    ECS2 -.-> SNS
    SNS -.-> SES
    SNS -.-> Lambda2
    Lambda2 --> S3Data
    Lambda1 --> DynamoDB
    NAT --> SQS
    NAT --> SNS
    ECS1 -.-> CW
    ECS2 -.-> CW
    Bastion -.-> ECS1
arch_cloud_k8s
Cluster Namespace: App Namespace: Data Backend Namespace: Monitoring Ingress Frontend Workers External Client Requests External DNS Cert Manager Nginx Ingress TLS Termination frontend-pod-1 frontend-pod-2 frontend-svc api-pod-1 api-pod-2 api-pod-3 api-svc HPA Autoscaler worker-pod-1 worker-pod-2 worker-svc postgres-primary postgres-replica redis-cluster postgres-svc Prometheus Grafana Loki Alertmanager ConfigMaps Secrets Persistent Volumes
Source (.mmd)
flowchart TD
    subgraph External
        Client[Client Requests]
        DNS[External DNS]
        CertMgr[Cert Manager]
    end

    subgraph Cluster
        subgraph Ingress
            Nginx[Nginx Ingress]
            TLS[TLS Termination]
        end

        subgraph Namespace: App
            subgraph Frontend
                FE1[frontend-pod-1]
                FE2[frontend-pod-2]
                FESvc[frontend-svc]
            end
            subgraph Backend
                BE1[api-pod-1]
                BE2[api-pod-2]
                BE3[api-pod-3]
                BESvc[api-svc]
                HPA[HPA Autoscaler]
            end
            subgraph Workers
                W1[worker-pod-1]
                W2[worker-pod-2]
                WSvc[worker-svc]
            end
        end

        subgraph Namespace: Data
            PG1[(postgres-primary)]
            PG2[(postgres-replica)]
            RedisCluster[(redis-cluster)]
            PGSvc[postgres-svc]
        end

        subgraph Namespace: Monitoring
            Prom[Prometheus]
            Grafana[Grafana]
            Loki[Loki]
            Alert[Alertmanager]
        end

        ConfigMap[ConfigMaps]
        Secrets[Secrets]
        PV[Persistent Volumes]
    end

    Client --> DNS
    DNS --> Nginx
    CertMgr -.-> TLS
    Nginx --> TLS
    TLS --> FESvc
    TLS --> BESvc
    FESvc --> FE1
    FESvc --> FE2
    FE1 --> BESvc
    FE2 --> BESvc
    BESvc --> BE1
    BESvc --> BE2
    BESvc --> BE3
    HPA -.-> BE1
    HPA -.-> BE2
    HPA -.-> BE3
    BE1 --> PGSvc
    BE2 --> PGSvc
    BE3 --> PGSvc
    BE1 --> RedisCluster
    BE2 --> RedisCluster
    PGSvc --> PG1
    PG1 -.-> PG2
    BE1 -.-> WSvc
    WSvc --> W1
    WSvc --> W2
    W1 --> PGSvc
    W2 --> PGSvc
    ConfigMap -.-> BE1
    Secrets -.-> BE1
    PV -.-> PG1
    Prom -.-> BE1
    Prom -.-> FE1
    Prom -.-> W1
    Prom --> Grafana
    Prom --> Alert
    Loki -.-> Grafana
arch_compiler_pipeline
Frontend Backend Middle End Linker Targets ok error Source Code Lexer / Tokenizer Parser Abstract Syntax Tree Semantic Analysis Type Checker Symbol Table IR Generation High-Level IR Constant Folding Dead Code Elimination Function Inlining Loop Optimization Mid-Level IR SSA Conversion Register Allocation Low-Level IR Instruction Selection Instruction Scheduling Peephole Optimization Code Generation x86_64 Assembly ARM64 Assembly WebAssembly LLVM Bitcode Object Files Static Libraries Dynamic Libraries Linker Executable
Source (.mmd)
flowchart LR
    subgraph Frontend
        Source[Source Code]
        Lexer[Lexer / Tokenizer]
        Parser[Parser]
        AST[Abstract Syntax Tree]
        SemanticCheck{Semantic Analysis}
        TypeCheck[Type Checker]
        SymTable[(Symbol Table)]
    end

    subgraph Middle End
        IRGen[IR Generation]
        HIR[High-Level IR]
        ConstFold[Constant Folding]
        DeadCode[Dead Code Elimination]
        Inline[Function Inlining]
        LoopOpt[Loop Optimization]
        MIR[Mid-Level IR]
        SSA[SSA Conversion]
        RegAlloc[Register Allocation]
        LIR[Low-Level IR]
    end

    subgraph Backend
        InstSel[Instruction Selection]
        InstSched[Instruction Scheduling]
        PeepHole[Peephole Optimization]
        CodeGen[Code Generation]
    end

    subgraph Targets
        x86[x86_64 Assembly]
        ARM[ARM64 Assembly]
        WASM[WebAssembly]
        LLVM[LLVM Bitcode]
    end

    subgraph Linker
        ObjFile[Object Files]
        StaticLink[Static Libraries]
        DynLink[Dynamic Libraries]
        Linker_[Linker]
        Executable[Executable]
    end

    Source --> Lexer
    Lexer --> Parser
    Parser --> AST
    AST --> SemanticCheck
    SemanticCheck -->|error| Source
    SemanticCheck -->|ok| TypeCheck
    TypeCheck --> SymTable
    TypeCheck --> IRGen

    IRGen --> HIR
    HIR --> ConstFold
    ConstFold --> DeadCode
    DeadCode --> Inline
    Inline --> LoopOpt
    LoopOpt --> MIR
    MIR --> SSA
    SSA --> RegAlloc
    RegAlloc --> LIR

    LIR --> InstSel
    InstSel --> InstSched
    InstSched --> PeepHole
    PeepHole --> CodeGen

    CodeGen --> x86
    CodeGen --> ARM
    CodeGen --> WASM
    CodeGen --> LLVM

    x86 --> ObjFile
    ARM --> ObjFile
    ObjFile --> Linker_
    StaticLink --> Linker_
    DynLink --> Linker_
    Linker_ --> Executable
arch_component
Undertow HTTP Server Infrastructure Client Layer MCP Layer "/health/ " "/metrics" "/mcp" wires wires wires configures provides provides coordinates threaded by HTTPS Virtual Thread Dispatch CorsHandler TracingHandler OTel spans + correlation ID RoutingHandler HealthHandler live / ready / started MetricsHandler Prometheus format UndertowMcpTransport POST: JSON-RPC GET: SSE stream DELETE: session cleanup MCP Java SDK McpSyncServer WeatherTools getCurrentWeather getForecast searchLocations WeatherApiClient Failsafe retry + circuit breaker Apache HttpClient 5 connection pooling Main.java composition root ConfigLoader → Config config.toml + .env + env vars Telemetry OTel SDK (real or noop) GracefulShutdown LIFO hooks, timeout CorrelationId ScopedValue + MDC External APIs weatherapi.com
Source (.mmd)
graph TB
    subgraph "Undertow HTTP Server"
        VT["Virtual Thread Dispatch"]
        VT --> CORS["CorsHandler"]
        CORS --> TRACE["TracingHandler<br/><i>OTel spans + correlation ID</i>"]
        TRACE --> ROUTE["RoutingHandler"]

        ROUTE -->|"/health/*"| HEALTH["HealthHandler<br/><i>live / ready / started</i>"]
        ROUTE -->|"/metrics"| METRICS["MetricsHandler<br/><i>Prometheus format</i>"]
        ROUTE -->|"/mcp"| TRANSPORT["UndertowMcpTransport<br/><i>POST: JSON-RPC<br/>GET: SSE stream<br/>DELETE: session cleanup</i>"]
    end

    subgraph "MCP Layer"
        TRANSPORT --> SDK["MCP Java SDK<br/><i>McpSyncServer</i>"]
        SDK --> TOOLS["WeatherTools<br/><i>getCurrentWeather<br/>getForecast<br/>searchLocations</i>"]
    end

    subgraph "Client Layer"
        TOOLS --> CLIENT["WeatherApiClient"]
        CLIENT --> FAILSAFE["Failsafe<br/><i>retry + circuit breaker</i>"]
        FAILSAFE --> HTTP["Apache HttpClient 5<br/><i>connection pooling</i>"]
    end

    subgraph "Infrastructure"
        MAIN["Main.java<br/><i>composition root</i>"] -.->|wires| VT
        MAIN -.->|wires| SDK
        MAIN -.->|wires| CLIENT
        CONFIG["ConfigLoader → Config<br/><i>config.toml + .env + env vars</i>"] -.->|configures| MAIN
        TEL["Telemetry<br/><i>OTel SDK (real or noop)</i>"] -.->|provides| TRACE
        TEL -.->|provides| METRICS
        GS["GracefulShutdown<br/><i>LIFO hooks, timeout</i>"] -.->|coordinates| MAIN
        CID["CorrelationId<br/><i>ScopedValue + MDC</i>"] -.->|threaded by| TRACE
    end

    HTTP -->|HTTPS| EXT["External APIs<br/><i>weatherapi.com</i>"]
arch_data_mesh
Infrastructure Self-Serve Platform Domain: Inventory Domain: Customers Domain: Orders Domain: Marketing Order API Order Data Product Transform Pipeline Order Data Store Data Catalog Entry Customer API Customer Data Product Transform Pipeline Customer Data Store Data Catalog Entry Inventory API Inventory Data Product Transform Pipeline Inventory Data Store Data Catalog Entry Marketing Consumer Enrichment Pipeline Marketing Data Store Campaign Dashboard Federated Data Catalog Access Policies Quality Framework Schema Registry Data Lineage Graph Data Observability Data Mesh Bus Shared Compute Shared Storage Global Governance
Source (.mmd)
graph TD
    subgraph Domain: Orders
        OrderAPI[Order API]
        OrderProducer[Order Data Product]
        OrderTransform[Transform Pipeline]
        OrderStore[(Order Data Store)]
        OrderCatalog[Data Catalog Entry]
    end

    subgraph Domain: Customers
        CustAPI[Customer API]
        CustProducer[Customer Data Product]
        CustTransform[Transform Pipeline]
        CustStore[(Customer Data Store)]
        CustCatalog[Data Catalog Entry]
    end

    subgraph Domain: Inventory
        InvAPI[Inventory API]
        InvProducer[Inventory Data Product]
        InvTransform[Transform Pipeline]
        InvStore[(Inventory Data Store)]
        InvCatalog[Data Catalog Entry]
    end

    subgraph Domain: Marketing
        MktConsumer[Marketing Consumer]
        MktEnrich[Enrichment Pipeline]
        MktStore[(Marketing Data Store)]
        MktDash[Campaign Dashboard]
    end

    subgraph Self-Serve Platform
        DataCatalog[Federated Data Catalog]
        AccessControl{Access Policies}
        DataQuality[Quality Framework]
        SchemaRegistry[Schema Registry]
        Lineage[Data Lineage Graph]
        Observability[Data Observability]
    end

    subgraph Infrastructure
        Mesh[Data Mesh Bus]
        Compute[Shared Compute]
        Storage[Shared Storage]
        Governance[Global Governance]
    end

    OrderAPI --> OrderTransform
    OrderTransform --> OrderStore
    OrderStore --> OrderProducer
    OrderProducer --> Mesh
    OrderCatalog --> DataCatalog

    CustAPI --> CustTransform
    CustTransform --> CustStore
    CustStore --> CustProducer
    CustProducer --> Mesh
    CustCatalog --> DataCatalog

    InvAPI --> InvTransform
    InvTransform --> InvStore
    InvStore --> InvProducer
    InvProducer --> Mesh
    InvCatalog --> DataCatalog

    Mesh --> MktConsumer
    MktConsumer --> MktEnrich
    MktEnrich --> MktStore
    MktStore --> MktDash

    DataCatalog --> AccessControl
    AccessControl --> Mesh
    DataQuality -.-> OrderTransform
    DataQuality -.-> CustTransform
    DataQuality -.-> InvTransform
    SchemaRegistry -.-> Mesh
    Lineage -.-> DataCatalog
    Observability -.-> DataQuality

    Governance --> DataCatalog
    Governance --> AccessControl
    Governance --> SchemaRegistry
    Compute -.-> OrderTransform
    Compute -.-> CustTransform
    Compute -.-> InvTransform
    Storage -.-> OrderStore
    Storage -.-> CustStore
    Storage -.-> InvStore
arch_data_pipeline_etl
Storage Landing Orchestration Transform Ingestion Sources Serving pass fail MySQL OLTP PostgreSQL S3 Raw Logs Kafka Topics REST APIs SFTP Drops Debezium CDC Kinesis Firehose Airbyte Sync Custom Ingester S3 Landing Zone Schema Registry Spark Jobs dbt Models Data Quality Lineage Tracker S3 Data Lake Apache Iceberg Redshift Snowflake Looker Metabase Jupyter Notebooks ML Feature Store Data API Apache Airflow Pipeline Monitor PagerDuty
Source (.mmd)
flowchart LR
    subgraph Sources
        MySQL[(MySQL OLTP)]
        Postgres[(PostgreSQL)]
        S3Raw[S3 Raw Logs]
        Kafka[Kafka Topics]
        API[REST APIs]
        SFTP[SFTP Drops]
    end

    subgraph Ingestion
        Debezium[Debezium CDC]
        Firehose[Kinesis Firehose]
        Airbyte[Airbyte Sync]
        Custom[Custom Ingester]
    end

    subgraph Landing
        S3Landing[S3 Landing Zone]
        Schema{Schema Registry}
    end

    subgraph Transform
        Spark[Spark Jobs]
        DBT[dbt Models]
        Quality{Data Quality}
        Lineage[Lineage Tracker]
    end

    subgraph Storage
        S3Lake[S3 Data Lake]
        Iceberg[(Apache Iceberg)]
        Redshift[(Redshift)]
        Snowflake[(Snowflake)]
    end

    subgraph Serving
        Looker[Looker]
        Metabase[Metabase]
        Notebook[Jupyter Notebooks]
        MLFeatures[ML Feature Store]
        APIServe[Data API]
    end

    subgraph Orchestration
        Airflow[Apache Airflow]
        Monitor[Pipeline Monitor]
        AlertPager[PagerDuty]
    end

    MySQL --> Debezium
    Postgres --> Debezium
    S3Raw --> Firehose
    Kafka --> Firehose
    API --> Airbyte
    SFTP --> Custom
    Debezium --> S3Landing
    Firehose --> S3Landing
    Airbyte --> S3Landing
    Custom --> S3Landing
    S3Landing --> Schema
    Schema --> Spark
    Spark --> DBT
    DBT --> Quality
    Quality -->|pass| S3Lake
    Quality -->|fail| Monitor
    S3Lake --> Iceberg
    Iceberg --> Redshift
    Iceberg --> Snowflake
    Redshift --> Looker
    Redshift --> Metabase
    Snowflake --> Looker
    Snowflake --> Notebook
    Iceberg --> MLFeatures
    Iceberg --> APIServe
    Airflow -.-> Spark
    Airflow -.-> DBT
    Airflow -.-> Custom
    Lineage -.-> DBT
    Monitor -.-> AlertPager
arch_database_replication
Sharding Backup and Recovery Application Layer Read Replicas Write Path Analytics writes reads reads reads sync async async delayed App Server 1 App Server 2 App Server 3 PgBouncer Pool PostgreSQL Primary WAL Sender Logical Replication Sync Replica 1 Async Replica 2 Async Replica 3 Delayed Replica - 1hr Shard Router Shard 1: users A-M Shard 2: users N-Z Shard 3: archive pg_basebackup WAL Archive - S3 Point-in-Time Recovery Daily Snapshots Debezium CDC Data Warehouse Reporting Queries
Source (.mmd)
flowchart TD
    subgraph Application Layer
        App1[App Server 1]
        App2[App Server 2]
        App3[App Server 3]
        ConnPool[PgBouncer Pool]
    end

    subgraph Write Path
        Primary[(PostgreSQL Primary)]
        WAL[WAL Sender]
        Logical[Logical Replication]
    end

    subgraph Read Replicas
        Sync1[(Sync Replica 1)]
        Async1[(Async Replica 2)]
        Async2[(Async Replica 3)]
        DelayedRep[(Delayed Replica - 1hr)]
    end

    subgraph Sharding
        ShardRouter{Shard Router}
        Shard1[(Shard 1: users A-M)]
        Shard2[(Shard 2: users N-Z)]
        Shard3[(Shard 3: archive)]
    end

    subgraph Backup and Recovery
        BaseBackup[pg_basebackup]
        WALArchive[WAL Archive - S3]
        PITR[Point-in-Time Recovery]
        Snapshot[Daily Snapshots]
    end

    subgraph Analytics
        CDC[Debezium CDC]
        Warehouse[(Data Warehouse)]
        Reporting[Reporting Queries]
    end

    App1 --> ConnPool
    App2 --> ConnPool
    App3 --> ConnPool
    ConnPool -->|writes| Primary
    ConnPool -->|reads| Sync1
    ConnPool -->|reads| Async1
    ConnPool -->|reads| Async2

    Primary --> WAL
    WAL ==>|sync| Sync1
    WAL ==>|async| Async1
    WAL ==>|async| Async2
    WAL ==>|delayed| DelayedRep
    WAL --> WALArchive

    Primary --> Logical
    Logical --> ShardRouter
    ShardRouter --> Shard1
    ShardRouter --> Shard2
    ShardRouter --> Shard3

    Primary --> BaseBackup
    BaseBackup --> Snapshot
    WALArchive --> PITR
    Snapshot --> PITR

    Logical --> CDC
    CDC --> Warehouse
    Warehouse --> Reporting
    DelayedRep -.-> Reporting
arch_event_driven
Command Side Read Side Sagas Event Bus Projections valid invalid Web UI Command API Validate Command Handler Event Store Kafka Cluster Dead Letter Queue Schema Registry Order Projection Inventory Projection Reporting Projection Search Projection Order Read DB Inventory Read DB Report DW Elasticsearch Query API Dashboard Order Saga Payment Saga Compensate Handler
Source (.mmd)
flowchart TD
    subgraph Command Side
        UI[Web UI]
        APICMD[Command API]
        Validator{Validate}
        CmdHandler[Command Handler]
        EventStore[(Event Store)]
    end

    subgraph Event Bus
        Kafka[Kafka Cluster]
        DLQ[Dead Letter Queue]
        SchemaReg[Schema Registry]
    end

    subgraph Projections
        OrderProj[Order Projection]
        InventoryProj[Inventory Projection]
        ReportProj[Reporting Projection]
        SearchProj[Search Projection]
    end

    subgraph Read Side
        OrderDB[(Order Read DB)]
        InventoryDB[(Inventory Read DB)]
        ReportDB[(Report DW)]
        SearchIdx[(Elasticsearch)]
        QueryAPI[Query API]
        Dashboard[Dashboard]
    end

    subgraph Sagas
        OrderSaga[Order Saga]
        PaymentSaga[Payment Saga]
        CompensateSaga[Compensate Handler]
    end

    UI --> APICMD
    APICMD --> Validator
    Validator -->|valid| CmdHandler
    Validator -->|invalid| UI
    CmdHandler --> EventStore
    EventStore -.-> Kafka
    Kafka --> SchemaReg
    Kafka --> OrderProj
    Kafka --> InventoryProj
    Kafka --> ReportProj
    Kafka --> SearchProj
    Kafka -.-> DLQ
    Kafka --> OrderSaga
    Kafka --> PaymentSaga
    OrderProj --> OrderDB
    InventoryProj --> InventoryDB
    ReportProj --> ReportDB
    SearchProj --> SearchIdx
    OrderDB --> QueryAPI
    InventoryDB --> QueryAPI
    SearchIdx --> QueryAPI
    ReportDB --> Dashboard
    QueryAPI --> UI
    OrderSaga -.-> CmdHandler
    PaymentSaga -.-> CmdHandler
    PaymentSaga -.-> CompensateSaga
    CompensateSaga -.-> CmdHandler
arch_game_engine
Core Rendering Network Input AI Physics Audio Game Loop Entity Component System Event System Resource Manager Scene Graph Keyboard Handler Mouse Handler Gamepad Handler Touch Handler Input Mapper Collision Detection Rigid Body Dynamics Raycasting Physics World Render Graph Forward Pass Deferred Pass Shadow Maps Post Processing UI Renderer GPU Command Buffer Audio Mixer Sound Effects Music Streamer Spatial Audio Behavior Trees A Pathfinding Navigation Mesh FSM Controller Network Client Network Server Client Prediction Server Reconciliation State Snapshots
Source (.mmd)
graph TD
    subgraph Core
        GameLoop[Game Loop]
        ECS[Entity Component System]
        EventSystem[Event System]
        ResourceMgr[Resource Manager]
        SceneGraph[Scene Graph]
    end

    subgraph Input
        Keyboard[Keyboard Handler]
        Mouse[Mouse Handler]
        Gamepad[Gamepad Handler]
        Touch[Touch Handler]
        InputMapper[Input Mapper]
    end

    subgraph Physics
        Collider[Collision Detection]
        RigidBody[Rigid Body Dynamics]
        Raycast[Raycasting]
        PhysWorld[Physics World]
    end

    subgraph Rendering
        RenderGraph[Render Graph]
        ForwardPass[Forward Pass]
        DeferredPass[Deferred Pass]
        ShadowPass[Shadow Maps]
        PostFX[Post Processing]
        UIRender[UI Renderer]
        GPU[GPU Command Buffer]
    end

    subgraph Audio
        AudioMixer[Audio Mixer]
        SFX[Sound Effects]
        Music[Music Streamer]
        Spatial[Spatial Audio]
    end

    subgraph AI
        BehaviorTree[Behavior Trees]
        Pathfinding[A* Pathfinding]
        NavMesh[Navigation Mesh]
        StateMachine[FSM Controller]
    end

    subgraph Network
        NetClient[Network Client]
        NetServer[Network Server]
        Prediction[Client Prediction]
        Reconcile[Server Reconciliation]
        Snapshot[State Snapshots]
    end

    GameLoop --> ECS
    GameLoop --> EventSystem
    ECS --> SceneGraph

    Keyboard --> InputMapper
    Mouse --> InputMapper
    Gamepad --> InputMapper
    Touch --> InputMapper
    InputMapper --> EventSystem

    EventSystem --> PhysWorld
    PhysWorld --> Collider
    PhysWorld --> RigidBody
    PhysWorld --> Raycast
    Collider --> ECS

    SceneGraph --> RenderGraph
    RenderGraph --> ShadowPass
    RenderGraph --> DeferredPass
    RenderGraph --> ForwardPass
    ShadowPass --> PostFX
    DeferredPass --> PostFX
    ForwardPass --> PostFX
    PostFX --> UIRender
    UIRender --> GPU
    ResourceMgr --> GPU

    EventSystem --> AudioMixer
    AudioMixer --> SFX
    AudioMixer --> Music
    AudioMixer --> Spatial

    ECS --> BehaviorTree
    BehaviorTree --> Pathfinding
    Pathfinding --> NavMesh
    BehaviorTree --> StateMachine

    EventSystem --> NetClient
    NetClient --> Prediction
    NetServer --> Reconcile
    NetServer --> Snapshot
    Snapshot -.-> NetClient
    Prediction -.-> Reconcile
arch_hexagonal
Application Core Domain Use Cases Ports In Driving Adapters Driven Adapters Ports Out REST API GraphQL API gRPC Service CLI Commands Event Consumer Job Scheduler CreateOrder Port GetOrder Port CancelOrder Port ProcessPayment Port Order Entity OrderItem VO Money VO Order Policy Domain Events Create Order UC Get Order UC Cancel Order UC Process Payment UC OrderRepository Port PaymentGateway Port Notification Port EventBus Port PostgreSQL Adapter Redis Adapter Stripe Adapter Email Adapter SMS Adapter Kafka Adapter
Source (.mmd)
flowchart LR
    subgraph Driving Adapters
        REST[REST API]
        GraphQL[GraphQL API]
        gRPC[gRPC Service]
        CLI[CLI Commands]
        EventIn[Event Consumer]
        Scheduler[Job Scheduler]
    end

    subgraph Application Core
        subgraph Ports In
            CreateOrder[CreateOrder Port]
            GetOrder[GetOrder Port]
            CancelOrder[CancelOrder Port]
            ProcessPayment[ProcessPayment Port]
        end

        subgraph Domain
            OrderEntity[Order Entity]
            OrderItem[OrderItem VO]
            Money[Money VO]
            OrderPolicy{Order Policy}
            DomainEvent[Domain Events]
        end

        subgraph Use Cases
            CreateOrderUC[Create Order UC]
            GetOrderUC[Get Order UC]
            CancelOrderUC[Cancel Order UC]
            PaymentUC[Process Payment UC]
        end

        subgraph Ports Out
            OrderRepo[OrderRepository Port]
            PaymentGW[PaymentGateway Port]
            NotifyPort[Notification Port]
            EventBus[EventBus Port]
        end
    end

    subgraph Driven Adapters
        PGAdapter[PostgreSQL Adapter]
        RedisAdapter[Redis Adapter]
        StripeAdapter[Stripe Adapter]
        EmailAdapter[Email Adapter]
        SMSAdapter[SMS Adapter]
        KafkaAdapter[Kafka Adapter]
    end

    REST --> CreateOrder
    REST --> GetOrder
    GraphQL --> GetOrder
    gRPC --> ProcessPayment
    CLI --> CancelOrder
    EventIn --> ProcessPayment
    Scheduler --> GetOrder

    CreateOrder --> CreateOrderUC
    GetOrder --> GetOrderUC
    CancelOrder --> CancelOrderUC
    ProcessPayment --> PaymentUC

    CreateOrderUC --> OrderEntity
    CreateOrderUC --> OrderPolicy
    CreateOrderUC --> OrderRepo
    CreateOrderUC --> EventBus
    GetOrderUC --> OrderRepo
    CancelOrderUC --> OrderEntity
    CancelOrderUC --> OrderRepo
    CancelOrderUC --> NotifyPort
    PaymentUC --> Money
    PaymentUC --> PaymentGW
    PaymentUC --> OrderRepo

    OrderEntity --> OrderItem
    OrderEntity --> Money
    OrderPolicy --> DomainEvent

    OrderRepo --> PGAdapter
    OrderRepo --> RedisAdapter
    PaymentGW --> StripeAdapter
    NotifyPort --> EmailAdapter
    NotifyPort --> SMSAdapter
    EventBus --> KafkaAdapter
arch_iot_platform
Edge Devices Edge Computing Processing Cloud Ingestion Storage Applications Real-time Batch Alerts local action cloud forward yes no Temperature Sensors Humidity Sensors IP Cameras Smart Actuators Edge Gateway Edge ML Inference Local Buffer Edge Rules Engine MQTT Broker IoT Core Kinesis Data Stream IoT Rules Engine Device Shadow Kinesis Analytics Lambda Functions Alert Threshold? AWS Glue ETL EMR Spark SageMaker Training TimescaleDB S3 Data Lake DynamoDB Metadata Redshift Analytics Real-time Dashboard Mobile App REST API Reporting Engine ML Model Serving SNS Notifications PagerDuty Slack Channel
Source (.mmd)
flowchart TD
    subgraph Edge Devices
        Sensor1[Temperature Sensors]
        Sensor2[Humidity Sensors]
        Camera[IP Cameras]
        Actuator[Smart Actuators]
        Gateway[Edge Gateway]
    end

    subgraph Edge Computing
        EdgeML[Edge ML Inference]
        EdgeBuffer[Local Buffer]
        EdgeRules{Edge Rules Engine}
        MQTT[MQTT Broker]
    end

    subgraph Cloud Ingestion
        IoTCore[IoT Core]
        KinesisStream[Kinesis Data Stream]
        IoTRules{IoT Rules Engine}
        DeviceShadow[Device Shadow]
    end

    subgraph Processing
        subgraph Real-time
            KinesisAnalytics[Kinesis Analytics]
            Lambda[Lambda Functions]
            AlertEngine{Alert Threshold?}
        end
        subgraph Batch
            Glue[AWS Glue ETL]
            EMR[EMR Spark]
            SageMaker[SageMaker Training]
        end
    end

    subgraph Storage
        TimeseriesDB[(TimescaleDB)]
        S3Lake[S3 Data Lake]
        DDB[(DynamoDB Metadata)]
        Redshift[(Redshift Analytics)]
    end

    subgraph Applications
        Dashboard[Real-time Dashboard]
        MobileApp[Mobile App]
        API[REST API]
        Reports[Reporting Engine]
        MLModels[ML Model Serving]
    end

    subgraph Alerts
        SNS[SNS Notifications]
        PagerDuty[PagerDuty]
        SlackAlert[Slack Channel]
    end

    Sensor1 --> Gateway
    Sensor2 --> Gateway
    Camera --> Gateway
    Gateway --> MQTT
    MQTT --> EdgeML
    MQTT --> EdgeBuffer
    MQTT --> EdgeRules
    EdgeRules -->|local action| Actuator
    EdgeRules -->|cloud forward| IoTCore
    EdgeBuffer --> IoTCore
    EdgeML -.-> Actuator

    IoTCore --> KinesisStream
    IoTCore --> IoTRules
    IoTCore --> DeviceShadow
    DeviceShadow --> API

    KinesisStream --> KinesisAnalytics
    KinesisStream --> Lambda
    KinesisAnalytics --> AlertEngine
    AlertEngine -->|yes| SNS
    AlertEngine -->|no| TimeseriesDB
    Lambda --> TimeseriesDB
    Lambda --> DDB

    KinesisStream --> S3Lake
    S3Lake --> Glue
    Glue --> Redshift
    S3Lake --> EMR
    EMR --> SageMaker
    SageMaker --> MLModels

    TimeseriesDB --> Dashboard
    TimeseriesDB --> API
    Redshift --> Reports
    DDB --> API
    API --> MobileApp
    MLModels --> EdgeML

    SNS --> PagerDuty
    SNS --> SlackAlert
    SNS --> MobileApp
arch_message_queue
Broker Cluster Consumer Groups Dead Letter Broker 3 Producers Broker 1 Broker 2 Order Processing Payment Processing Notifications Analytics Order API User API Payment API Scheduled Jobs External Webhooks orders.created P0 orders.created P1 payments.processed P0 orders.created P2 payments.processed P1 users.updated P0 orders.created Replica payments.processed Replica users.updated Replica ZooKeeper Ensemble order-consumer-1 order-consumer-2 order-consumer-3 payment-consumer-1 payment-consumer-2 analytics-consumer-1 notify-consumer-1 notify-consumer-2 Dead Letter Queue DLQ Processor DLQ Alert
Source (.mmd)
flowchart TD
    subgraph Producers
        OrderAPI[Order API]
        UserAPI[User API]
        PaymentAPI[Payment API]
        CronJobs[Scheduled Jobs]
        Webhooks[External Webhooks]
    end

    subgraph Broker Cluster
        subgraph Broker 1
            Topic1P1[orders.created P0]
            Topic1P2[orders.created P1]
            Topic2P1[payments.processed P0]
        end
        subgraph Broker 2
            Topic1P3[orders.created P2]
            Topic2P2[payments.processed P1]
            Topic3P1[users.updated P0]
        end
        subgraph Broker 3
            Topic1R[orders.created Replica]
            Topic2R[payments.processed Replica]
            Topic3R[users.updated Replica]
        end
        ZK[ZooKeeper Ensemble]
    end

    subgraph Consumer Groups
        subgraph Order Processing
            OC1[order-consumer-1]
            OC2[order-consumer-2]
            OC3[order-consumer-3]
        end
        subgraph Payment Processing
            PC1[payment-consumer-1]
            PC2[payment-consumer-2]
        end
        subgraph Analytics
            AC1[analytics-consumer-1]
        end
        subgraph Notifications
            NC1[notify-consumer-1]
            NC2[notify-consumer-2]
        end
    end

    subgraph Dead Letter
        DLQ[(Dead Letter Queue)]
        DLQProcessor[DLQ Processor]
        DLQAlert[DLQ Alert]
    end

    OrderAPI --> Topic1P1
    OrderAPI --> Topic1P2
    PaymentAPI --> Topic2P1
    UserAPI --> Topic3P1
    CronJobs --> Topic1P1
    Webhooks --> Topic2P1

    Topic1P1 -.-> Topic1R
    Topic2P1 -.-> Topic2R
    Topic3P1 -.-> Topic3R

    ZK -.-> Topic1P1
    ZK -.-> Topic2P1
    ZK -.-> Topic3P1

    Topic1P1 --> OC1
    Topic1P2 --> OC2
    Topic1P3 --> OC3
    Topic2P1 --> PC1
    Topic2P2 --> PC2
    Topic1P1 --> AC1
    Topic2P1 --> AC1
    Topic3P1 --> AC1
    Topic1P1 --> NC1
    Topic2P1 --> NC2

    OC1 -.-> DLQ
    PC1 -.-> DLQ
    DLQ --> DLQProcessor
    DLQProcessor -.-> DLQAlert
arch_microservices_basic
Data Services Gateway Clients Web App Mobile App CLI Tool Load Balancer API Gateway Auth Service User Service Order Service Product Service Payment Service Notification Service User DB Order DB Product DB Redis Cache Message Queue
Source (.mmd)
graph LR
    subgraph Clients
        Web[Web App]
        Mobile[Mobile App]
        CLI[CLI Tool]
    end

    subgraph Gateway
        LB[Load Balancer]
        API[API Gateway]
        Auth[Auth Service]
    end

    subgraph Services
        Users[User Service]
        Orders[Order Service]
        Products[Product Service]
        Payments[Payment Service]
        Notify[Notification Service]
    end

    subgraph Data
        UserDB[(User DB)]
        OrderDB[(Order DB)]
        ProductDB[(Product DB)]
        Cache[(Redis Cache)]
        MQ[Message Queue]
    end

    Web --> LB
    Mobile --> LB
    CLI --> LB
    LB --> API
    API --> Auth
    Auth -.-> UserDB
    API --> Users
    API --> Orders
    API --> Products
    Users --> UserDB
    Users --> Cache
    Orders --> OrderDB
    Orders --> Payments
    Orders -.-> MQ
    Products --> ProductDB
    Products --> Cache
    Payments -.-> Notify
    MQ -.-> Notify
    Notify -.-> Users
arch_microservices_ecommerce
Core Services Async Payments Edge Ordering API Layer Fulfillment Catalog Frontend Pass Fail React SPA Admin Panel React Native CloudFront CDN WAF Rules Application LB API Gateway Authorization Rate Limiter Catalog Service Search Service Catalog DB Elasticsearch Order Service Cart Service Order DB Cart Cache Inventory Service Shipping Service Warehouse DB Payment Service Fraud Check Ledger DB Stripe API Kafka Event Bus Notification Service Analytics Ingest Email Service SMS Service
Source (.mmd)
flowchart TD
    subgraph Frontend
        WebApp[React SPA]
        AdminUI[Admin Panel]
        MobileApp[React Native]
    end

    subgraph Edge
        CDN[CloudFront CDN]
        WAF{WAF Rules}
        ALB[Application LB]
    end

    subgraph API Layer
        Gateway[API Gateway]
        AuthZ[Authorization]
        RateLimit[Rate Limiter]
    end

    subgraph Core Services
        subgraph Catalog
            CatalogSvc[Catalog Service]
            Search[Search Service]
            CatalogDB[(Catalog DB)]
            SearchIdx[(Elasticsearch)]
        end
        subgraph Ordering
            OrderSvc[Order Service]
            CartSvc[Cart Service]
            OrderDB[(Order DB)]
            CartCache[(Cart Cache)]
        end
        subgraph Fulfillment
            InventorySvc[Inventory Service]
            ShippingSvc[Shipping Service]
            WarehouseDB[(Warehouse DB)]
        end
    end

    subgraph Payments
        PaymentSvc[Payment Service]
        FraudDetect{Fraud Check}
        PaymentDB[(Ledger DB)]
        Stripe[Stripe API]
    end

    subgraph Async
        EventBus[Kafka Event Bus]
        NotifySvc[Notification Service]
        AnalyticsSvc[Analytics Ingest]
        EmailSvc[Email Service]
        SMSSvc[SMS Service]
    end

    WebApp --> CDN
    AdminUI --> CDN
    MobileApp --> ALB
    CDN --> WAF
    WAF --> ALB
    ALB --> Gateway
    Gateway --> AuthZ
    Gateway --> RateLimit
    RateLimit --> CatalogSvc
    RateLimit --> OrderSvc
    RateLimit --> CartSvc
    CatalogSvc --> CatalogDB
    CatalogSvc --> SearchIdx
    Search --> SearchIdx
    OrderSvc --> OrderDB
    OrderSvc --> PaymentSvc
    CartSvc --> CartCache
    CartSvc -.-> OrderSvc
    PaymentSvc --> FraudDetect
    FraudDetect -->|Pass| Stripe
    FraudDetect -->|Fail| PaymentDB
    Stripe --> PaymentDB
    OrderSvc -.-> EventBus
    PaymentSvc -.-> EventBus
    EventBus -.-> InventorySvc
    EventBus -.-> ShippingSvc
    EventBus -.-> NotifySvc
    EventBus -.-> AnalyticsSvc
    InventorySvc --> WarehouseDB
    ShippingSvc --> WarehouseDB
    NotifySvc --> EmailSvc
    NotifySvc --> SMSSvc
arch_ml_pipeline
Training Feature Engineering Evaluation Monitoring Serving Data Collection pass fail pass fail winner inconclusive yes no Application Logs User Events User Surveys External Data APIs Raw Data Lake Feature Calculator Feature Store Feature Validation MLflow Experiment Tracker Training Job Hyperparameter Tuning GPU Cluster Model Registry Evaluation Pipeline A/B Test Gate Shadow Mode Model Metrics Bias Audit TorchServe Batch Inference Real-time API Prediction Cache Fallback Model Data Drift? Performance Monitor Alert Pipeline Trigger Retrain
Source (.mmd)
graph LR
    subgraph Data Collection
        Logs[Application Logs]
        Events[User Events]
        Surveys[User Surveys]
        External[External Data APIs]
    end

    subgraph Feature Engineering
        RawStore[(Raw Data Lake)]
        FeatureCalc[Feature Calculator]
        FeatureStore[(Feature Store)]
        FeatureVal{Feature Validation}
    end

    subgraph Training
        ExpTracker[MLflow Experiment Tracker]
        TrainJob[Training Job]
        HPTune[Hyperparameter Tuning]
        GPU[GPU Cluster]
        ModelReg[(Model Registry)]
    end

    subgraph Evaluation
        EvalJob[Evaluation Pipeline]
        ABTest{A/B Test Gate}
        ShadowMode[Shadow Mode]
        Metrics[Model Metrics]
        BiasCheck{Bias Audit}
    end

    subgraph Serving
        ModelServer[TorchServe]
        Batch[Batch Inference]
        RealTime[Real-time API]
        Cache[(Prediction Cache)]
        Fallback[Fallback Model]
    end

    subgraph Monitoring
        DriftDetect{Data Drift?}
        PerfMon[Performance Monitor]
        AlertPipe[Alert Pipeline]
        Retrain[Trigger Retrain]
    end

    Logs --> RawStore
    Events --> RawStore
    Surveys --> RawStore
    External --> RawStore
    RawStore --> FeatureCalc
    FeatureCalc --> FeatureVal
    FeatureVal -->|pass| FeatureStore
    FeatureVal -->|fail| AlertPipe
    FeatureStore --> TrainJob
    TrainJob --> ExpTracker
    TrainJob --> HPTune
    HPTune --> GPU
    GPU --> ModelReg
    ModelReg --> EvalJob
    EvalJob --> Metrics
    EvalJob --> BiasCheck
    BiasCheck -->|pass| ABTest
    BiasCheck -->|fail| ExpTracker
    ABTest -->|winner| ModelServer
    ABTest -->|inconclusive| ShadowMode
    ShadowMode --> Metrics
    ModelServer --> RealTime
    ModelServer --> Batch
    RealTime --> Cache
    ModelServer -.-> Fallback
    RealTime -.-> DriftDetect
    DriftDetect -->|yes| Retrain
    DriftDetect -->|no| PerfMon
    Retrain -.-> TrainJob
    PerfMon -.-> AlertPipe
arch_monitoring_stack
Collection Storage Alerting Applications Metrics Path Traces Path Visualization Logs Path P1 P2 P3 Service A Service B Service C Batch Jobs Infrastructure StatsD Agent Prometheus Push Gateway Fluentd Vector Syslog Drain OpenTelemetry SDK OTel Collector Jaeger Agent Mimir - Metrics Loki - Logs Tempo - Traces S3 Long-term Grafana Dashboards Explore View Alertmanager PagerDuty Slack Email Escalation Policy
Source (.mmd)
graph LR
    subgraph Applications
        App1[Service A]
        App2[Service B]
        App3[Service C]
        App4[Batch Jobs]
        Infra[Infrastructure]
    end

    subgraph Collection
        subgraph Metrics Path
            StatsD[StatsD Agent]
            Prom[Prometheus]
            PushGW[Push Gateway]
        end
        subgraph Logs Path
            Fluentd[Fluentd]
            Vector[Vector]
            Syslog[Syslog Drain]
        end
        subgraph Traces Path
            OTelSDK[OpenTelemetry SDK]
            OTelCol[OTel Collector]
            Jaeger[Jaeger Agent]
        end
    end

    subgraph Storage
        Mimir[(Mimir - Metrics)]
        Loki[(Loki - Logs)]
        Tempo[(Tempo - Traces)]
        S3[S3 Long-term]
    end

    subgraph Visualization
        Grafana[Grafana]
        GrafanaDash[Dashboards]
        Explore[Explore View]
    end

    subgraph Alerting
        AlertMgr[Alertmanager]
        PagerDuty[PagerDuty]
        Slack[Slack]
        Email[Email]
        Escalation{Escalation Policy}
    end

    App1 --> StatsD
    App2 --> StatsD
    App3 --> StatsD
    App4 --> PushGW
    StatsD --> Prom
    PushGW --> Prom
    Infra --> Prom
    Prom --> Mimir

    App1 --> Fluentd
    App2 --> Vector
    App3 --> Vector
    App4 --> Syslog
    Infra --> Syslog
    Fluentd --> Loki
    Vector --> Loki
    Syslog --> Loki

    App1 --> OTelSDK
    App2 --> OTelSDK
    App3 --> OTelSDK
    OTelSDK --> OTelCol
    OTelCol --> Jaeger
    Jaeger --> Tempo

    Mimir --> Grafana
    Loki --> Grafana
    Tempo --> Grafana
    Grafana --> GrafanaDash
    Grafana --> Explore

    Mimir --> S3
    Loki --> S3
    Tempo --> S3

    Prom --> AlertMgr
    AlertMgr --> Escalation
    Escalation -->|P1| PagerDuty
    Escalation -->|P2| Slack
    Escalation -->|P3| Email
arch_multi_region
Global US-East EU-West AP-Southeast replication replication sync sync Global Server LB CockroachDB Global CDN Edge Network GeoDNS Load Balancer App Server 1 App Server 2 Redis Primary PostgreSQL Primary SQS Queue Workers Load Balancer App Server 1 App Server 2 Redis Replica PostgreSQL Replica SQS Queue Workers Load Balancer App Server 1 Redis Replica PostgreSQL Replica SQS Queue Workers
Source (.mmd)
graph LR
    subgraph Global
        GSLB[Global Server LB]
        GlobalDB[(CockroachDB Global)]
        CDN[CDN Edge Network]
        DNS[GeoDNS]
    end

    subgraph US-East
        LB_US[Load Balancer]
        App_US1[App Server 1]
        App_US2[App Server 2]
        Cache_US[(Redis Primary)]
        DB_US[(PostgreSQL Primary)]
        Queue_US[SQS Queue]
        Worker_US[Workers]
    end

    subgraph EU-West
        LB_EU[Load Balancer]
        App_EU1[App Server 1]
        App_EU2[App Server 2]
        Cache_EU[(Redis Replica)]
        DB_EU[(PostgreSQL Replica)]
        Queue_EU[SQS Queue]
        Worker_EU[Workers]
    end

    subgraph AP-Southeast
        LB_AP[Load Balancer]
        App_AP1[App Server 1]
        Cache_AP[(Redis Replica)]
        DB_AP[(PostgreSQL Replica)]
        Queue_AP[SQS Queue]
        Worker_AP[Workers]
    end

    DNS --> GSLB
    GSLB --> LB_US
    GSLB --> LB_EU
    GSLB --> LB_AP
    CDN --> LB_US
    CDN --> LB_EU
    CDN --> LB_AP

    LB_US --> App_US1
    LB_US --> App_US2
    App_US1 --> Cache_US
    App_US1 --> DB_US
    App_US2 --> Cache_US
    App_US2 --> DB_US
    App_US1 -.-> Queue_US
    Queue_US -.-> Worker_US
    Worker_US --> DB_US

    LB_EU --> App_EU1
    LB_EU --> App_EU2
    App_EU1 --> Cache_EU
    App_EU1 --> DB_EU
    App_EU2 --> Cache_EU
    App_EU2 --> DB_EU
    App_EU1 -.-> Queue_EU
    Queue_EU -.-> Worker_EU
    Worker_EU --> DB_EU

    LB_AP --> App_AP1
    App_AP1 --> Cache_AP
    App_AP1 --> DB_AP
    App_AP1 -.-> Queue_AP
    Queue_AP -.-> Worker_AP
    Worker_AP --> DB_AP

    DB_US ==>|replication| DB_EU
    DB_US ==>|replication| DB_AP
    Cache_US ==>|sync| Cache_EU
    Cache_US ==>|sync| Cache_AP
    DB_US --> GlobalDB
    DB_EU --> GlobalDB
    DB_AP --> GlobalDB
arch_serverless
Lambda Functions Managed Services Monitoring Triggers Edge API Gateway S3 Event SQS Message CloudWatch Schedule DynamoDB Stream IoT Rule Auth Lambda API Handler Lambda Image Resize Lambda ETL Lambda Stream Processor Lambda Notification Lambda IoT Processor Lambda Cognito User Pool DynamoDB Tables S3 Buckets SQS Queues SNS Topics SES Email Step Functions AppSync GraphQL CloudFront Lambda@Edge S3 Static Site X-Ray Tracing CloudWatch Logs CloudWatch Alarm Dashboard
Source (.mmd)
graph TD
    subgraph Triggers
        APIGateway[API Gateway]
        S3Event[S3 Event]
        SQSEvent[SQS Message]
        Schedule[CloudWatch Schedule]
        DDBStream[DynamoDB Stream]
        IoTRule[IoT Rule]
    end

    subgraph Lambda Functions
        AuthFn[Auth Lambda]
        APIFN[API Handler Lambda]
        ImageFn[Image Resize Lambda]
        ETLFn[ETL Lambda]
        StreamFn[Stream Processor Lambda]
        NotifyFn[Notification Lambda]
        IoTFn[IoT Processor Lambda]
    end

    subgraph Managed Services
        Cognito[Cognito User Pool]
        DDB[(DynamoDB Tables)]
        S3Bucket[S3 Buckets]
        SQS[SQS Queues]
        SNS[SNS Topics]
        SES[SES Email]
        StepFn[Step Functions]
        AppSync[AppSync GraphQL]
    end

    subgraph Edge
        CloudFront[CloudFront]
        LambdaEdge[Lambda@Edge]
        S3Static[S3 Static Site]
    end

    subgraph Monitoring
        XRay[X-Ray Tracing]
        CWLogs[CloudWatch Logs]
        CWAlarm{CloudWatch Alarm}
        Dashboard[Dashboard]
    end

    CloudFront --> LambdaEdge
    CloudFront --> S3Static
    LambdaEdge --> APIGateway

    APIGateway --> AuthFn
    AuthFn --> Cognito
    APIGateway --> APIFN
    APIFN --> DDB
    APIFN --> S3Bucket
    APIFN -.-> SQS

    S3Event --> ImageFn
    ImageFn --> S3Bucket

    SQSEvent --> ETLFn
    ETLFn --> DDB
    ETLFn -.-> StepFn
    StepFn -.-> ETLFn

    Schedule --> StreamFn
    DDBStream --> StreamFn
    StreamFn --> SNS
    StreamFn -.-> SQS

    SNS --> NotifyFn
    NotifyFn --> SES
    NotifyFn --> SQS

    IoTRule --> IoTFn
    IoTFn --> DDB
    IoTFn -.-> SNS

    AppSync --> DDB

    AuthFn -.-> XRay
    APIFN -.-> XRay
    APIFN -.-> CWLogs
    CWLogs --> CWAlarm
    CWAlarm --> SNS
    XRay --> Dashboard
    CWLogs --> Dashboard
arch_service_mesh
Data Plane Control Plane Pod A Observability Ingress Policies Pod C Pod B Pod D mTLS mTLS mTLS mTLS Istiod Pilot - Config Citadel - mTLS Galley - Validation CA Root Service A Envoy Sidecar Service B Envoy Sidecar Service C Envoy Sidecar Service D Envoy Sidecar Istio Ingress Gateway Virtual Services Destination Rules Kiali Dashboard Zipkin Traces Prometheus Auth Policies Rate Limits Retry Config Circuit Breaker
Source (.mmd)
flowchart TD
    subgraph Control Plane
        Istiod[Istiod]
        Pilot[Pilot - Config]
        Citadel[Citadel - mTLS]
        Galley[Galley - Validation]
        CertAuth[CA Root]
    end

    subgraph Data Plane
        subgraph Pod A
            AppA[Service A]
            ProxyA[Envoy Sidecar]
        end
        subgraph Pod B
            AppB[Service B]
            ProxyB[Envoy Sidecar]
        end
        subgraph Pod C
            AppC[Service C]
            ProxyC[Envoy Sidecar]
        end
        subgraph Pod D
            AppD[Service D]
            ProxyD[Envoy Sidecar]
        end
    end

    subgraph Ingress
        IngressGW[Istio Ingress Gateway]
        VirtualSvc[Virtual Services]
        DestRule[Destination Rules]
    end

    subgraph Observability
        Kiali[Kiali Dashboard]
        Zipkin[Zipkin Traces]
        PromMesh[Prometheus]
    end

    subgraph Policies
        AuthPolicy[Auth Policies]
        RatePolicy[Rate Limits]
        RetryPolicy[Retry Config]
        CBPolicy[Circuit Breaker]
    end

    Istiod --> Pilot
    Istiod --> Citadel
    Istiod --> Galley
    Citadel --> CertAuth

    Pilot -.-> ProxyA
    Pilot -.-> ProxyB
    Pilot -.-> ProxyC
    Pilot -.-> ProxyD
    Citadel -.-> ProxyA
    Citadel -.-> ProxyB

    IngressGW --> VirtualSvc
    VirtualSvc --> DestRule
    DestRule --> ProxyA

    AppA --> ProxyA
    ProxyA ==>|mTLS| ProxyB
    ProxyA ==>|mTLS| ProxyC
    ProxyB ==>|mTLS| ProxyD
    ProxyC ==>|mTLS| ProxyD
    ProxyB --> AppB
    ProxyC --> AppC
    ProxyD --> AppD

    ProxyA -.-> PromMesh
    ProxyB -.-> PromMesh
    ProxyC -.-> Zipkin
    ProxyD -.-> Zipkin
    PromMesh --> Kiali

    AuthPolicy -.-> Istiod
    RatePolicy -.-> Istiod
    RetryPolicy -.-> Istiod
    CBPolicy -.-> Istiod
arch_streaming_platform
Backend Transcoding Storage Delivery Playback Content Ingestion pass fail Creator Upload Live Encoder Partner Feed Transcode Queue FFmpeg Worker 1 FFmpeg Worker 2 FFmpeg Worker 3 Quality OK? Origin Server S3 VOD Storage S3 Thumbnails Manifest Generator CDN Region US CDN Region EU CDN Region APAC Edge Cache Adaptive Bitrate Web Player iOS Player Android Player Smart TV App Auth Service Catalog Service Recommendation Engine Subscription Service Analytics Service Search Service Catalog DB User DB ClickHouse Elasticsearch
Source (.mmd)
graph LR
    subgraph Content Ingestion
        Upload[Creator Upload]
        LiveStream[Live Encoder]
        Partner[Partner Feed]
    end

    subgraph Transcoding
        TranscodeQ[Transcode Queue]
        Worker1[FFmpeg Worker 1]
        Worker2[FFmpeg Worker 2]
        Worker3[FFmpeg Worker 3]
        QualityCheck{Quality OK?}
    end

    subgraph Storage
        Origin[Origin Server]
        S3VOD[S3 VOD Storage]
        S3Thumb[S3 Thumbnails]
        Manifest[Manifest Generator]
    end

    subgraph Delivery
        CDN1[CDN Region US]
        CDN2[CDN Region EU]
        CDN3[CDN Region APAC]
        EdgeCache[Edge Cache]
        ABR{Adaptive Bitrate}
    end

    subgraph Playback
        WebPlayer[Web Player]
        iOSPlayer[iOS Player]
        AndroidPlayer[Android Player]
        SmartTV[Smart TV App]
    end

    subgraph Backend
        AuthSvc[Auth Service]
        CatalogSvc[Catalog Service]
        RecSvc[Recommendation Engine]
        SubSvc[Subscription Service]
        AnalyticsSvc[Analytics Service]
        SearchSvc[Search Service]
        CatalogDB[(Catalog DB)]
        UserDB[(User DB)]
        AnalyticsDB[(ClickHouse)]
        SearchIdx[(Elasticsearch)]
    end

    Upload --> TranscodeQ
    LiveStream --> TranscodeQ
    Partner --> TranscodeQ
    TranscodeQ --> Worker1
    TranscodeQ --> Worker2
    TranscodeQ --> Worker3
    Worker1 --> QualityCheck
    Worker2 --> QualityCheck
    Worker3 --> QualityCheck
    QualityCheck -->|pass| S3VOD
    QualityCheck -->|fail| TranscodeQ
    S3VOD --> Origin
    S3VOD --> Manifest
    Worker1 --> S3Thumb

    Origin --> CDN1
    Origin --> CDN2
    Origin --> CDN3
    CDN1 --> EdgeCache
    CDN2 --> EdgeCache
    CDN3 --> EdgeCache
    EdgeCache --> ABR
    ABR --> WebPlayer
    ABR --> iOSPlayer
    ABR --> AndroidPlayer
    ABR --> SmartTV

    WebPlayer --> AuthSvc
    WebPlayer --> CatalogSvc
    WebPlayer --> RecSvc
    WebPlayer --> SearchSvc
    AuthSvc --> UserDB
    CatalogSvc --> CatalogDB
    RecSvc --> AnalyticsDB
    SubSvc --> UserDB
    SearchSvc --> SearchIdx
    WebPlayer -.-> AnalyticsSvc
    AnalyticsSvc --> AnalyticsDB
    Manifest --> CatalogSvc
arch_zero_trust
No Yes No Yes Unusual Normal Off-hours Normal High Medium Low API App Infra User Device Trusted? Device Enrollment MDM Check Identity Verified? Multi-Factor Auth Identity Provider Context Assessment Location OK? Access Hours? Risk Score? Step-Up Auth Policy Decision Point Block Access Resource Type API Proxy App Proxy Bastion Proxy Microsegmentation Just-in-Time Access End-to-End Encryption Protected Resource Audit Log SIEM Platform Security Analytics
Source (.mmd)
flowchart TD
    User[User] --> Device{Device Trusted?}

    Device -->|No| Enroll[Device Enrollment]
    Enroll --> MDM[MDM Check]
    MDM --> Device

    Device -->|Yes| Identity{Identity Verified?}

    Identity -->|No| MFA[Multi-Factor Auth]
    MFA --> IdP[Identity Provider]
    IdP --> Identity

    Identity -->|Yes| Context{Context Assessment}

    Context --> Location{Location OK?}
    Context --> Time{Access Hours?}
    Context --> Risk{Risk Score?}

    Location -->|Unusual| StepUp[Step-Up Auth]
    Location -->|Normal| PolicyEngine
    Time -->|Off-hours| StepUp
    Time -->|Normal| PolicyEngine
    Risk -->|High| Block[Block Access]
    Risk -->|Medium| StepUp
    Risk -->|Low| PolicyEngine
    StepUp --> PolicyEngine

    PolicyEngine[Policy Decision Point]

    PolicyEngine --> ResourceType{Resource Type}
    ResourceType -->|API| APIProxy[API Proxy]
    ResourceType -->|App| AppProxy[App Proxy]
    ResourceType -->|Infra| BastionProxy[Bastion Proxy]

    APIProxy --> MicroSeg{Microsegmentation}
    AppProxy --> MicroSeg
    BastionProxy --> JIT[Just-in-Time Access]
    JIT --> MicroSeg

    MicroSeg --> Encrypt[End-to-End Encryption]
    Encrypt --> Resource[Protected Resource]

    Resource -.-> AuditLog[(Audit Log)]
    Resource -.-> SIEM[SIEM Platform]
    Resource -.-> Analytics[Security Analytics]
    AuditLog -.-> SIEM
    SIEM -.-> Analytics
    Analytics -.-> PolicyEngine
arrows
Normal Arrow No arrow Dotted Thick Circle end Cross end Bidir arrow Bidir circle Bidir cross
Source (.mmd)
flowchart TD
    A[Normal] --> B[Arrow]
    A --- C[No arrow]
    A -.-> D[Dotted]
    A ==> E[Thick]
    B --o F((Circle end))
    B --x G((Cross end))
    C <--> H[Bidir arrow]
    H o--o I[Bidir circle]
    H x--x J[Bidir cross]
chain_branching
A B C D E F G
Source (.mmd)
flowchart TD
    A --> B
    A --> C
    B --> D
    C --> D
    D --> E
    D --> F
    E --> G
    F --> G
chain_long
A B C D E F G H
Source (.mmd)
flowchart TD
    A --> B --> C --> D --> E --> F --> G --> H
ci_pipeline
Build Test Deploy Yes No Checkout Install Deps Compile Unit Tests Integration Pass? Stage Prod Fix & Retry
Source (.mmd)
flowchart LR
    subgraph build[Build]
        A[Checkout] --> B[Install Deps]
        B --> C[Compile]
    end
    subgraph test[Test]
        D[Unit Tests] --> E[Integration]
        E --> F{Pass?}
    end
    subgraph deploy[Deploy]
        G[Stage] --> H[Prod]
    end
    C --> D
    F -->|Yes| G
    F -->|No| I[Fix & Retry]
    I --> A
combo_all_arrows_labeled
normal arrow thick arrow dotted arrow open solid circle end cross end bidirectional bidir circle bidir cross thick label dotted label Center Normal Thick Dotted Open Circle Cross Labeled Thick Labeled Dotted
Source (.mmd)
flowchart TD
    A[Center] -->|normal arrow| B[Normal]
    A ==>|thick arrow| C[Thick]
    A -.->|dotted arrow| D[Dotted]
    A ---|open solid| E[Open]
    A --o|circle end| F[Circle]
    A --x|cross end| G[Cross]
    B <-->|bidirectional| C
    D o--o|bidir circle| E
    F x--x|bidir cross| G
    C == thick label ==> H[Labeled Thick]
    D -. dotted label .-> I[Labeled Dotted]
combo_styled_shapes
Stadium Diamond Cylinder Circle Subroutine Hexagon Parallelogram
Source (.mmd)
flowchart TD
    A([Stadium]):::green --> B{Diamond}:::red
    B --> C[(Cylinder)]:::blue
    B --> D((Circle)):::green
    C --> E[[Subroutine]]:::red
    D --> E
    E --> F{{Hexagon}}:::blue
    F --> G[/Parallelogram/]:::green

    classDef green fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
    classDef red fill:#ffcdd2,stroke:#b71c1c,stroke-width:2px
    classDef blue fill:#bbdefb,stroke:#0d47a1,stroke-width:2px
combo_subgraph_styled
Processing Input Layer Output Layer pass fail File Upload Validate Transform Enrich Check Store Notify
Source (.mmd)
flowchart TD
    subgraph inputs[Input Layer]
        I1[File Upload]:::primary --> I2[Validate]:::warning
    end
    subgraph processing[Processing]
        P1[Transform]:::primary --> P2[Enrich]:::primary
        P2 --> P3{Check}:::danger
    end
    subgraph outputs[Output Layer]
        O1[(Store)]:::info --> O2[Notify]:::success
    end
    I2 --> P1
    P3 -->|pass| O1
    P3 -->|fail| I1

    classDef primary fill:#1976d2,stroke:#0d47a1,color:#fff
    classDef warning fill:#ff9800,stroke:#e65100,color:#fff
    classDef danger fill:#d32f2f,stroke:#b71c1c,color:#fff
    classDef success fill:#388e3c,stroke:#1b5e20,color:#fff
    classDef info fill:#0288d1,stroke:#01579b,color:#fff

    linkStyle 0 stroke:#1976d2,stroke-width:2px
    linkStyle 4 stroke:#d32f2f,stroke-width:3px,stroke-dasharray:5
    linkStyle 5 stroke:#388e3c,stroke-width:2px
    linkStyle 6 stroke:#d32f2f,stroke-width:2px
compiler_pipeline
Frontend Backend Middle End Linker Targets ok error Source Code Lexer / Tokenizer Parser Abstract Syntax Tree Semantic Analysis Type Checker Symbol Table IR Generation High-Level IR Constant Folding Dead Code Elimination Function Inlining Loop Optimization Mid-Level IR SSA Conversion Register Allocation Low-Level IR Instruction Selection Instruction Scheduling Peephole Optimization Code Generation x86_64 Assembly ARM64 Assembly WebAssembly LLVM Bitcode Object Files Static Libraries Dynamic Libraries Linker Executable
Source (.mmd)
flowchart LR
    subgraph Frontend
        Source[Source Code]
        Lexer[Lexer / Tokenizer]
        Parser[Parser]
        AST[Abstract Syntax Tree]
        SemanticCheck{Semantic Analysis}
        TypeCheck[Type Checker]
        SymTable[(Symbol Table)]
    end

    subgraph Middle End
        IRGen[IR Generation]
        HIR[High-Level IR]
        ConstFold[Constant Folding]
        DeadCode[Dead Code Elimination]
        Inline[Function Inlining]
        LoopOpt[Loop Optimization]
        MIR[Mid-Level IR]
        SSA[SSA Conversion]
        RegAlloc[Register Allocation]
        LIR[Low-Level IR]
    end

    subgraph Backend
        InstSel[Instruction Selection]
        InstSched[Instruction Scheduling]
        PeepHole[Peephole Optimization]
        CodeGen[Code Generation]
    end

    subgraph Targets
        x86[x86_64 Assembly]
        ARM[ARM64 Assembly]
        WASM[WebAssembly]
        LLVM[LLVM Bitcode]
    end

    subgraph Linker
        ObjFile[Object Files]
        StaticLink[Static Libraries]
        DynLink[Dynamic Libraries]
        Linker_[Linker]
        Executable[Executable]
    end

    Source --> Lexer
    Lexer --> Parser
    Parser --> AST
    AST --> SemanticCheck
    SemanticCheck -->|error| Source
    SemanticCheck -->|ok| TypeCheck
    TypeCheck --> SymTable
    TypeCheck --> IRGen

    IRGen --> HIR
    HIR --> ConstFold
    ConstFold --> DeadCode
    DeadCode --> Inline
    Inline --> LoopOpt
    LoopOpt --> MIR
    MIR --> SSA
    SSA --> RegAlloc
    RegAlloc --> LIR

    LIR --> InstSel
    InstSel --> InstSched
    InstSched --> PeepHole
    PeepHole --> CodeGen

    CodeGen --> x86
    CodeGen --> ARM
    CodeGen --> WASM
    CodeGen --> LLVM

    x86 --> ObjFile
    ARM --> ObjFile
    ObjFile --> Linker_
    StaticLink --> Linker_
    DynLink --> Linker_
    Linker_ --> Executable
compound_simple
Group Node A Node B Node C
Source (.mmd)
graph TD
    subgraph cluster[Group]
        A[Node A] --> B[Node B]
    end
    B --> C[Node C]
crossing
A D E B F C
Source (.mmd)
graph TD
    A --> D
    A --> E
    B --> F
    B --> D
    C --> E
    C --> F
cycle
Yes No Fetch Valid? Process Retry Done
Source (.mmd)
flowchart TD
    A[Fetch] --> B{Valid?}
    B -->|Yes| C[Process]
    B -->|No| D[Retry]
    D --> A
    C --> E[Done]
cycle_3
Step 1 Step 2 Step 3
Source (.mmd)
graph TD
    A[Step 1] --> B[Step 2]
    B --> C[Step 3]
    C --> A
diamond
Top Left Right Bottom
Source (.mmd)
graph TD
    A[Top] --> B[Left]
    A --> C[Right]
    B --> D[Bottom]
    C --> D
diamond_flow
Yes No Yes No Request Auth? Admin? 401 Unauthorized Admin Panel User Dashboard Response
Source (.mmd)
flowchart TD
    A[Request] --> B{Auth?}
    B -->|Yes| C{Admin?}
    B -->|No| D[401 Unauthorized]
    C -->|Yes| E[Admin Panel]
    C -->|No| F[User Dashboard]
    E --> G[Response]
    F --> G
    D --> G
direction_lr_subgraph_tb
Authentication Processing Request Check Token Validate Claims Authorize Parse Body Transform Enrich Response
Source (.mmd)
flowchart LR
    Input[Request] --> subA
    subgraph subA[Authentication]
        direction TB
        Check[Check Token] --> Validate[Validate Claims]
        Validate --> Authorize[Authorize]
    end
    subA --> subB
    subgraph subB[Processing]
        direction TB
        Parse[Parse Body] --> Transform[Transform]
        Transform --> Enrich[Enrich]
    end
    subB --> Output[Response]
directions
OK Fail Input Check Process Error Output
Source (.mmd)
flowchart LR
    A[Input] --> B{Check}
    B -->|OK| C[Process]
    B -->|Fail| D[Error]
    C --> E([Output])
    D --> E
directions_all
Top Down Bottom
Source (.mmd)
flowchart TD
    A[Top] --> B[Down] --> C[Bottom]
directions_bt
Bottom Up Top
Source (.mmd)
flowchart BT
    A[Bottom] --> B[Up] --> C[Top]
directions_lr
Left Middle Right
Source (.mmd)
flowchart LR
    A[Left] --> B[Middle] --> C[Right]
[Part 1] Part 2 Part 3