# fscdesarrollo/learning-internal-gateway architecture

> Architecture diagram of the GitHub repository fscdesarrollo/learning-internal-gateway, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fscdesarrollo/learning-internal-gateway
- Repository: https://github.com/fscdesarrollo/learning-internal-gateway

## Overview

##### Project type and purpose
- Full-stack proof-of-concept for internal gateway communication
- Uses .NET Core 8 microservice (Transactions.API), an API gateway (Learning.InternalGateway.Gateway with Ocelot), a Razor-Pages web front end, and Keycloak for authentication

##### File structure
- Top-level solution (Learning.InternalGateway.sln) and docker-compose.yml for spin-up
- “src/…Gateway” – the Ocelot API gateway project, with ocelot.json routing config and shared middleware (AuthorizationHandler)
- “src/…Transactions.API” – a backend microservice exposing transaction endpoints
- “src/…Web” – Razor-Pages UI that calls the gateway via ITransactionApi service, serves static assets under wwwroot
- “src/…Shared” – common code (DTOs, logger config, authorization handlers) reused by gateway and API

##### README for additional insights
- PoC uses .NET Core 8, Ocelot, Keycloak
- No explicit database project—assume Transactions.API will connect to a data store (can be mocked or added later)

##### Elements
- Clear labels on each component (e.g., “Learning.InternalGateway.Gateway (Ocelot)”)
– Blue for front-end/UI
– Green for API Gateway
– Orange for microservices
– Purple for external/auth (Keycloak)
– Gray for data store

## Diagram (Mermaid)

```mermaid
flowchart TB
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef gateway fill:#E0F8E0,stroke:#28A745,color:#28A745;
    classDef microservice fill:#FFE8B0,stroke:#D58A00,color:#D58A00;
    classDef auth fill:#F0E0FF,stroke:#6F42C1,color:#6F42C1;
    classDef datastore fill:#E8E8E8,stroke:#6A737D,color:#6A737D;
    classDef shared fill:#FFF5E5,stroke:#BF4F74,color:#BF4F74;
    classDef compose fill:#F1F8FF,stroke:#0366D6,color:#0366D6;
    classDef external fill:#FFFFFF,stroke:#444444,color:#444444;

    externalUser(["User"]):::external

    subgraph "Web Frontend"
        Web["Razor-Pages UI"]:::frontend
        WebDir["src/Learning.InternalGateway.Web"]:::frontend
    end

    subgraph "API Gateway"
        Gateway["Learning.InternalGateway.Gateway (Ocelot)"]:::gateway
        GatewayDir["src/Learning.InternalGateway.Gateway"]:::gateway
    end

    subgraph "Transactions Microservice"
        Transactions["Transactions.API"]:::microservice
        TransDir["src/Learning.InternalGateway.Transactions.API"]:::microservice
    end

    subgraph "Shared Library"
        Shared["Shared Library"]:::shared
        SharedDir["src/Learning.InternalGateway.Shared"]:::shared
    end

    Keycloak["Keycloak Auth Server"]:::auth
    DataStore["Data Store"]:::datastore

    Solution["Learning.InternalGateway.sln"]:::compose
    Compose["docker-compose.yml"]:::compose

    externalUser -->|"HTTP/HTTPS"| Web
    Web -->|"ITransactionApi calls"| Gateway
    Gateway -->|"Downstream HTTP"| Transactions
    Gateway -->|"Validate Token"| Keycloak
    Transactions -->|"CRUD Operations"| DataStore
    Shared -.-> Gateway
    Shared -.-> Transactions

    subgraph "Container Orchestration"
        Compose --- Web
        Compose --- Gateway
        Compose --- Transactions
        Compose --- Keycloak
        Compose --- DataStore
    end

    Solution --- Compose

    click WebDir "https://github.com/fscdesarrollo/learning-internal-gateway/blob/main/src/Learning.InternalGateway.Web"
    click GatewayDir "https://github.com/fscdesarrollo/learning-internal-gateway/blob/main/src/Learning.InternalGateway.Gateway"
    click TransDir "https://github.com/fscdesarrollo/learning-internal-gateway/blob/main/src/Learning.InternalGateway.Transactions.API"
    click SharedDir "https://github.com/fscdesarrollo/learning-internal-gateway/blob/main/src/Learning.InternalGateway.Shared"
    click Compose "https://github.com/fscdesarrollo/learning-internal-gateway/blob/main/docker-compose.yml"
    click Solution "https://github.com/fscdesarrollo/learning-internal-gateway/blob/main/Learning.InternalGateway.sln"
```
