# lateef10/infyshopmicroservice architecture

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

- Interactive diagram: https://gitdiagram.com/lateef10/infyshopmicroservice
- Repository: https://github.com/lateef10/infyshopmicroservice

## Overview

##### Main Components
- Web Front-End – Represented by the InfShop.Web project, which provides the user interface (MVC controllers, views, static assets) and interacts with the backend.
- API Gateway – Represented by InfyShop.GatewaySolution (likely using Ocelot) to centrally route requests from the web application to the various microservices.
- Microservices – Each service should be shown as an independent component:
– CouponAPI (InfyShop.CouponAPI): Handles coupon validation and related logic.
– OrderAPI (InfyShop.OrderAPI): Manages orders and messages for checkout.
– PaymentAPI (InfyShop.PaymentAPI): Processes payments (with integration to payment processing components such as InfyShop.PaymentProcessor).
– ProductAPI (InfyShop.ProductAPI): Manages product data.
– ShoppingCartAPI (InfyShop.ShoppingCartAPI): Handles shopping cart operations.
– Identity Service (InfyShop.Identity): Provides authentication and authorization, along with identity management (including IdentityServer configuration and related views/controllers).
- Message Bus – Shown via the InfyShop.MessageBus and messaging components in OrderAPI and PaymentAPI that use Azure Service Bus and RabbitMQ. This illustrates the asynchronous communication (publishing/subscribing patterns) between microservices.
- Shared Libraries – Components like InfyShop.Common and parts of the messaging libraries should be noted as shared or common infrastructural pieces.
- Databases – Although not a separate “service” in the file tree, each API includes its own DbContexts and Migrations. Indicate individual persistence stores or denote a shared database strategy if applicable.
- Deployment Infrastructure – Represent Docker (Dockerfiles per project), Kubernetes manifests (YAML files in AzureKubernetes, Kubernetes Local, and manifests folders), and CI/CD pipelines (the Pipelines folder and build status badges in the README).

##### Relationships and Interactions
- The API Gateway then routes requests to the corresponding backend microservices (Coupon API, Order API, etc.).
- Authentication and Authorization requests flow from the front-end (and perhaps from the Gateway as well) to the Identity Service.

##### Architectural Patterns and Technologies
- Microservices Architecture – Emphasize that each microservice (with its own codebase, database context, and Dockerfile) is independently deployed.
- API Gateway Pattern – InfyShop.GatewaySolution stands as the single entry point for client requests.
- Domain-Driven Design – The project is partitioned by business capabilities (coupons, orders, products, etc.).
- Messaging/Asynchronous Communication – Use of a dedicated Message Bus (Azure Service Bus or RabbitMQ implementations) to decouple services.
- Containerization and Orchestration – Docker, Kubernetes, and deployment manifests are used for scalability and resilient deployment.
- CI/CD Integration – Pipelines defined in the Pipelines directory show build and deployment automation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        FE["InfShop.Web (Frontend)"]:::frontend
    end

    %% API Gateway Layer
    subgraph "API Gateway Layer"
        GW["InfyShop.GatewaySolution (API Gateway)"]:::gateway
    end

    %% Microservices Layer
    subgraph "Microservices Layer"
        Coupon["Coupon Service (InfyShop.CouponAPI)"]:::microservice
        Order["Order Service (InfyShop.OrderAPI)"]:::microservice
        Payment["Payment Service (InfyShop.PaymentAPI)"]:::microservice
        Product["Product Service (InfyShop.ProductAPI)"]:::microservice
        Shopping["Shopping Cart Service (InfyShop.ShoppingCartAPI)"]:::microservice
        Identity["Identity Service (InfyShop.Identity)"]:::microservice
    end

    %% Messaging and Shared Infrastructure
    subgraph "Messaging & Shared Infrastructure"
        MessageBus["Message Bus (InfyShop.MessageBus)"]:::message
        Shared["Shared Libraries (InfyShop.Common)"]:::shared
    end

    %% Deployment & CI/CD
    subgraph "Deployment & CI/CD"
        Docker["Docker & Kubernetes Deployment"]:::infra
        Pipelines["CI/CD Pipelines"]:::cicd
    end

    %% Connections: Frontend to Gateway
    FE -->|"HTTPcalls"| GW

    %% Connections: Gateway routing to Microservices
    GW -->|"RoutesTo"| Coupon
    GW -->|"RoutesTo"| Order
    GW -->|"RoutesTo"| Payment
    GW -->|"RoutesTo"| Product
    GW -->|"RoutesTo"| Shopping

    %% Authentication flows from Frontend and Gateway to Identity Service
    FE -->|"AuthRequests"| Identity
    GW -->|"AuthValidation"| Identity

    %% Asynchronous communication via Message Bus
    Order -->|"PublishesEvent"| MessageBus
    Payment -->|"ConsumesEvent"| MessageBus

    %% Microservices using Shared Libraries
    Coupon -.->|"Uses"| Shared
    Order -.->|"Uses"| Shared
    Payment -.->|"Uses"| Shared
    Product -.->|"Uses"| Shared
    Shopping -.->|"Uses"| Shared
    Identity -.->|"Uses"| Shared

    %% Deployment: All services are containerized and deployed via Docker/Kubernetes
    FE -->|"DeployedVia"| Docker
    GW -->|"DeployedVia"| Docker
    Coupon -->|"DeployedVia"| Docker
    Order -->|"DeployedVia"| Docker
    Payment -->|"DeployedVia"| Docker
    Product -->|"DeployedVia"| Docker
    Shopping -->|"DeployedVia"| Docker
    Identity -->|"DeployedVia"| Docker
    MessageBus -->|"DeployedVia"| Docker

    %% CI/CD pipelines trigger deployment
    Pipelines -->|"Triggers"| Docker

    %% Class Definitions for Colors
    classDef frontend fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px;
    classDef gateway fill:#aed6f1,stroke:#2e86c1,stroke-width:2px;
    classDef microservice fill:#fadbd8,stroke:#c0392b,stroke-width:2px;
    classDef message fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef shared fill:#d6eaf8,stroke:#2874a6,stroke-width:2px;
    classDef infra fill:#fcf3cf,stroke:#f1c40f,stroke-width:2px;
    classDef cicd fill:#d7bde2,stroke:#8e44ad,stroke-width:2px;

    %% Click Events (component mapping)
    click FE "https://github.com/lateef10/infyshopmicroservice/tree/master/InfShop.Web/"
    click GW "https://github.com/lateef10/infyshopmicroservice/tree/master/InfyShop.GatewaySolution/"
    click Coupon "https://github.com/lateef10/infyshopmicroservice/tree/master/InfyShop.CouponAPI/"
    click Order "https://github.com/lateef10/infyshopmicroservice/tree/master/InfyShop.OrderAPI/"
    click Payment "https://github.com/lateef10/infyshopmicroservice/tree/master/InfyShop.PaymentAPI/"
    click Product "https://github.com/lateef10/infyshopmicroservice/tree/master/InfyShop.ProductAPI/"
    click Shopping "https://github.com/lateef10/infyshopmicroservice/tree/master/InfyShop.ShoppingCartAPI/"
    click Identity "https://github.com/lateef10/infyshopmicroservice/tree/master/InfyShop.Identity/"
    click MessageBus "https://github.com/lateef10/infyshopmicroservice/tree/master/InfyShop.MessageBus/"
    click Shared "https://github.com/lateef10/infyshopmicroservice/tree/master/InfyShop.Common/"
    click Pipelines "https://github.com/lateef10/infyshopmicroservice/tree/master/Pipelines/"
    click Docker "https://github.com/lateef10/infyshopmicroservice/tree/master/AzureKubernetes/"
```
