# rahulsahay19/eshopping architecture

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

- Interactive diagram: https://gitdiagram.com/rahulsahay19/eshopping
- Repository: https://github.com/rahulsahay19/eshopping

## Overview

##### Project Type and Purpose
- This is a full-stack .NET Core microservices e-commerce application built with Clean Architecture.
- It comprises multiple independently deployable microservices (Basket, Catalog, Discount, Ordering), an Identity Server for authentication/authorization, an API Gateway (Ocelot + Nginx), a single-page Angular client, and a deployment/configuration layer using Docker, Kubernetes, Helm, Istio, and observability tools (ELK, Prometheus/Grafana).

##### File Structure
- Top-level directories:
- ApiGateways (Ocelot.ApiGateway + nginx)
- Infrastructure (shared logging, Identity Server)
- Services (Basket, Catalog, Discount, Ordering each following Clean Architecture: API, Application, Core, Infrastructure)
- client (Angular frontend)
- Deployments (helm charts, k8s yamls, Istio)
- PostmanCollection
- Each microservice follows the pattern:
– API layer (Controllers, Startup, Program, Dockerfile)
– Application layer (Commands/Queries, Handlers, DTOs, gRPC clients where needed)
– Core layer (Entities, Repositories interfaces, Specs)
– Infrastructure layer (EF Core or Mongo/Postgres context, repository implementations, migrations/seed data)
- Cross-cutting middleware and logging in Infrastructure/Common.Logging.
- Identity Server under Infrastructure/EShopping.Identity implements OAuth2/OIDC.
- docker-compose, Helm charts, and Istio manifests orchestrate multi-service deployment and mesh.

##### README Insights
- Confirms technologies: .NET Core, Docker, Kubernetes, IdentityServer4, RabbitMQ (pub/sub), gRPC (Discount), Redis (Basket), MongoDB (Catalog), PostgreSQL (Ordering), ELK Stack, Ocelot API Gateway, Nginx, Istio service mesh, Azure, Helm, Auto-scale.
- Shows high-level architecture, deployment topology, service mesh, CI/CD hints.

- Frontend (blue)
- Gateway/auth (purple)
- Microservices (green)
- Datastores (orange)
- Infra (gray)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        UI["Angular Client"]:::frontend
    end

    %% API Gateway Layer
    subgraph "Edge/API Gateway"
        direction TB
        NG["Nginx"]:::gateway
        OG["Ocelot API Gateway"]:::gateway
    end

    %% Authentication
    subgraph "Authentication"
        direction TB
        ID["Identity Server"]:::auth
    end

    %% Service Mesh
    subgraph "Istio Service Mesh"
        direction TB
        %% Microservices inside mesh
        subgraph "Microservices"
            direction TB
            subgraph "Basket Service"
                direction TB
                BAPI["Basket.API"]:::service
                BDB["Redis"]:::db
            end
            subgraph "Catalog Service"
                direction TB
                CAPI["Catalog.API"]:::service
                CDB["MongoDB"]:::db
            end
            subgraph "Discount Service"
                direction TB
                DAPI["Discount.API (gRPC)"]:::service
                DDB["SQL DB"]:::db
            end
            subgraph "Ordering Service"
                direction TB
                OAPI["Ordering.API"]:::service
                ODB["PostgreSQL"]:::db
            end
        end
        RB["RabbitMQ"]:::bus
    end

    %% Observability & Deployment
    subgraph "Observability"
        direction TB
        ELK["ELK Stack"]:::infra
        PM["Prometheus/Grafana"]:::infra
    end

    subgraph "Deployment & Infra"
        direction TB
        HC["Helm Charts"]:::infra
        KM["Kubernetes Manifests"]:::infra
    end

    %% Flows
    UI --> OG
    OG --> ID
    OG --> BAPI
    OG --> CAPI
    OG --> DAPI
    OG --> OAPI

    BAPI -->|"gRPC GetCoupon()"| DAPI
    BAPI -->|"Publish BasketCheckoutEvent"| RB
    RB -->|"Consume BasketCheckoutEvent"| OAPI
    OAPI -->|"Send BasketDelete Command"| BAPI

    BAPI --> BDB
    CAPI --> CDB
    DAPI --> DDB
    OAPI --> ODB

    %% Observability connections
    BAPI --> ELK
    CAPI --> ELK
    DAPI --> ELK
    OAPI --> ELK
    RB --> ELK

    BAPI --> PM
    CAPI --> PM
    DAPI --> PM
    OAPI --> PM

    %% Deployment connections
    HC --> OG
    HC --> BAPI
    HC --> CAPI
    HC --> DAPI
    HC --> OAPI
    HC --> RB

    KM --> OG
    KM --> BAPI
    KM --> CAPI
    KM --> DAPI
    KM --> OAPI
    KM --> RB

    %% Click Events
    click UI "https://github.com/rahulsahay19/eshopping/tree/master/client/"
    click OG "https://github.com/rahulsahay19/eshopping/tree/master/ApiGateways/Ocelot.ApiGateway/"
    click NG "https://github.com/rahulsahay19/eshopping/tree/master/ApiGateways/nginx/"
    click ID "https://github.com/rahulsahay19/eshopping/tree/master/Infrastructure/EShopping.Identity/"
    click BAPI "https://github.com/rahulsahay19/eshopping/tree/master/Services/Basket/Basket.API/"
    click Services/Basket/Basket.Application/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Basket/Basket.Application/"
    click Services/Basket/Basket.Core/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Basket/Basket.Core/"
    click Services/Basket/Basket.Infrastructure/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Basket/Basket.Infrastructure/"
    click CAPI "https://github.com/rahulsahay19/eshopping/tree/master/Services/Catalog/Catalog.API/"
    click Services/Catalog/Catalog.Application/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Catalog/Catalog.Application/"
    click Services/Catalog/Catalog.Core/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Catalog/Catalog.Core/"
    click Services/Catalog/Catalog.Infrastructure/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Catalog/Catalog.Infrastructure/"
    click DAPI "https://github.com/rahulsahay19/eshopping/tree/master/Services/Discount/Discount.API/"
    click Services/Discount/Discount.Application/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Discount/Discount.Application/"
    click Services/Discount/Discount.Core/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Discount/Discount.Core/"
    click Services/Discount/Discount.Infrastructure/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Discount/Discount.Infrastructure/"
    click OAPI "https://github.com/rahulsahay19/eshopping/tree/master/Services/Ordering/Ordering.API/"
    click Services/Ordering/Ordering.Application/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Ordering/Ordering.Application/"
    click Services/Ordering/Ordering.Core/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Ordering/Ordering.Core/"
    click Services/Ordering/Ordering.Infrastructure/ "https://github.com/rahulsahay19/eshopping/tree/master/Services/Ordering/Ordering.Infrastructure/"
    click HC "https://github.com/rahulsahay19/eshopping/tree/master/Deployments/helm/"
    click KM "https://github.com/rahulsahay19/eshopping/tree/master/Deployments/k8s/"
    click RB "https://github.com/rahulsahay19/eshopping/tree/master/Infrastructure/EventBus.Messages/"

    %% Classes
    classDef frontend fill:#cce5ff,stroke:#66b0ff,color:#004085;
    classDef gateway fill:#e2ccff,stroke:#af80ff,color:#4b0082;
    classDef auth fill:#f0e68c,stroke:#f5de50,color:#8b8000;
    classDef service fill:#d4edda,stroke:#81c784,color:#155724;
    classDef db fill:#ffe5b4,stroke:#ffb74d,color:#8b4513;
    classDef bus fill:#ffebee,stroke:#ef9a9a,color:#c62828;
    classDef infra fill:#e2e3e5,stroke:#bcbfc4,color:#383d41;
```
