# Mermaid rendering test

Five diagrams from Kiran Garud’s [Learning Hub architecture notes](https://github.com/kirangarudofficial/Learning-Hub-Platform-Scalable-Microservices-Architecture-on-AWS-EKS-with-Event-Driven-Design/blob/main/ARCHITECTURE_DIAGRAMS.md). Each diagram uses the original Mermaid source. Scroll wide diagrams horizontally to read them at full size.

## AWS network

<div role="region" tabindex="0" aria-label="AWS network diagram" style="max-width:100%;overflow-x:auto">

```mermaid
graph TB
    subgraph "AWS Cloud (us-east-1)"
        subgraph "VPC (10.0.0.0/16)"
            subgraph "Public Subnets (Layer 1)"
                ALB[Application Load Balancer]
                NAT[NAT Gateways x3]
                IGW[Internet Gateway]
            end

            subgraph "Private App Subnets (Layer 2)"
                EKS_CP[EKS Control Plane]
                Lambda[Lambda Functions]
                NG_APP[Node Group 1: Application]
                NG_OPS[Node Group 2: Platform Ops]
            end

            subgraph "Private Data Subnets (Layer 3)"
                NG_DATA[Node Group 3: Data (Stateful)]
                EBS[EBS Volumes]
            end
        end

        Internet((Internet)) --> IGW
        IGW --> ALB
        ALB --> NG_APP
        NG_APP --> NG_DATA
        NG_OPS --> NG_APP
        NG_APP --> NAT
        NAT --> IGW
    end

    style ALB fill:#FF9900,stroke:#232F3E
    style EKS_CP fill:#FF9900,stroke:#232F3E
    style Lambda fill:#FF9900,stroke:#232F3E
    style NG_DATA fill:#3F8624,stroke:#232F3E
```

</div>

## Kubernetes cluster

<div role="region" tabindex="0" aria-label="Kubernetes cluster diagram" style="max-width:100%;overflow-x:auto">

```mermaid
graph TB
    subgraph "EKS Cluster"
        subgraph "Node Group 1: Application (Stateless)"
            NS_FE[Namespace: frontend]
            NS_CORE[Namespace: learning-core]
            NS_MEDIA[Namespace: media-ai]
            NS_COMMS[Namespace: communication-engagement]
            NS_BILL[Namespace: commerce-billing]
            NS_MKT[Namespace: growth-marketing]
            NS_INT[Namespace: data-intelligence]
        end

        subgraph "Node Group 2: Platform (Ops)"
            NS_OPS[Namespace: platform-ops]
            NS_MON[Namespace: monitoring]
            Jenkins[Jenkins Master/Agent]
            ArgoCD[ArgoCD Controller]
            Prom[Prometheus/Grafana]
        end

        subgraph "Node Group 3: Data (Stateful)"
            NS_DATA[Namespace: data-platform]
            Postgres[(PostgreSQL)]
            Mongo[(MongoDB)]
            Redis[(Redis)]
        end
    end

    NS_FE --> NS_CORE
    NS_CORE --> Postgres
    NS_MEDIA --> Mongo
    ArgoCD -.-> NS_FE
    ArgoCD -.-> NS_CORE
    ArgoCD -.-> NS_DATA
    Prom -.-> NS_FE

    style NS_DATA fill:#E6F3FF,stroke:#0073BB
    style Postgres fill:#336791,color:white
    style Mongo fill:#47A248,color:white
    style Redis fill:#D82C20,color:white
```

</div>

## Video processing

<div role="region" tabindex="0" aria-label="Video processing diagram" style="max-width:100%;overflow-x:auto">

```mermaid
sequenceDiagram
    participant User
    participant FE as Frontend
    participant API as Video Service
    participant S3_UP as S3 (Upload)
    participant EB as EventBridge
    participant Lambda as Lambda Orchestrator
    participant FFmpeg as Lambda Transcoder
    participant S3_ST as S3 (Stream)
    participant DDB as DynamoDB
    participant CF as CloudFront

    User->>FE: Upload Request
    FE->>API: Get Presigned URL
    API-->>FE: URL Returned
    FE->>S3_UP: Upload Video File
    S3_UP->>EB: ObjectCreated Event
    EB->>Lambda: Trigger Validation
    Lambda->>FFmpeg: Start Transcoding
    FFmpeg->>S3_ST: Save HLS Segments
    FFmpeg->>DDB: Update Status (READY)
    User->>FE: Request Playback
    FE->>API: Get Signed Cookie
    API-->>FE: CloudFront Token
    FE->>CF: Stream Video (HLS)
    CF->>S3_ST: Fetch Segments
    CF-->>User: Video Stream
```

</div>

## CI/CD pipeline

<div role="region" tabindex="0" aria-label="CI/CD pipeline diagram" style="max-width:100%;overflow-x:auto">

```mermaid
flowchart LR
    subgraph "CI: Jenkins (Shared Library)"
        Code[Checkout Code] --> Test[Unit Tests & Lint]
        Test --> Sec[Security Scan (Trivy/OWASP)]
        Sec --> Build[Docker Build]
        Build --> Push[Push to ECR]
        Push --> Update[Update GitOps Repo (Tags)]
    end

    subgraph "CD: ArgoCD (GitOps)"
        GitOps[GitOps Repo] --> Sync[ArgoCD Sync]
        Sync --> Apply[Apply Manifests]
        Apply --> EKS[EKS Cluster]
    end

    Update -.-> GitOps

    style CI fill:#D4EBF2
    style CD fill:#F2D4D4
    style Code fill:#FFFFFF
    style EKS fill:#326CE5,color:white
```

</div>

## Database architecture

<div role="region" tabindex="0" aria-label="Database architecture diagram" style="max-width:100%;overflow-x:auto">

```mermaid
graph TD
    subgraph "Node Group 3: Data"
        subgraph "PostgreSQL Cluster"
            PG_Primary[(Primary)]
            PG_Replica1[(Replica 1)]
            PG_Replica2[(Replica 2)]
        end

        subgraph "MongoDB Replica Set"
            Mongo_P[(Primary)]
            Mongo_S1[(Secondary)]
            Mongo_S2[(Secondary)]
        end

        subgraph "Redis"
            Redis_M[(Master)]
            Redis_R[(Replica)]
        end

        PVC[Persistent Volume Claims] --> EBS[EBS gp3 Volumes]
        EBS --- PG_Primary
        EBS --- Mongo_P
    end

    App[Application Services] -->|Write| PG_Primary
    App -->|Read| PG_Replica1
    App -->|Read/Write| Mongo_P
    App -->|Cache| Redis_M
```

</div>

<details>
<summary>Upstream license notices</summary>

~~~text
MIT License

Copyright (c) 2025 Kiran Garud

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
~~~

~~~text
BSD 3-Clause License

Copyright (c) 2025, soe1212

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~~

</details>
