# yamakazeankk/backend-inventory-asset-tracking-system architecture

> Architecture diagram of the GitHub repository yamakazeankk/backend-inventory-asset-tracking-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yamakazeankk/backend-inventory-asset-tracking-system
- Repository: https://github.com/yamakazeankk/backend-inventory-asset-tracking-system

## Overview

##### Project Type and Purpose
– This is a .NET 8–based microservices system for inventory and asset tracking.
– Domains split into independent Web API services, each encapsulating its own data and logic.
– An API Gateway (Ocelot) fronts all external requests; a SharedKernel library holds reusable DTOs, constants, and interfaces.

##### File Structure
– Top-level folders = microservices plus shared and gateway:
- AssetService, InventoryService, UserService, AssignmentService, ReportingService, ApiGateway, SharedKernel
– Each service contains Controllers, Program.cs, appsettings, and may include Services, Repositories, Models, Data, Mappings (per README).
– ApiGateway contains ocelot.json, middleware, and configuration.
– SharedKernel is a class library consumed by each service.

##### Key Insights from README
– Microservices architecture with one service per domain.
– API Gateway handles routing, authentication (JWT), logging.
– Each service uses EF Core, AutoMapper, Swagger (http files) as needed.

##### Main Components & Relationships
– API Gateway
– AssetService
– InventoryService
– UserService
– AssignmentService
– ReportingService
– SharedKernel (indicate as shared library)
– Databases (one per service)
– External systems (e.g., Authentication provider if separate)
b. Interactions:
– All client requests first hit the API Gateway → routed to appropriate service.
– Services are autonomous; some may call others internally (e.g., AssignmentService calls UserService & AssetService to validate users/assets).
– ReportingService aggregates data; may read from multiple service databases or expose separate endpoints.
c. Architectural Patterns:
– API Gateway pattern (Ocelot) for routing & cross-cutting concerns (auth, logging).
– Domain-driven microservices (one domain one service).
– Shared Kernel for common code.
– Each service follows layered architecture: Controllers → Services → Repositories → Data.
d. Technologies & Frameworks:
– .NET 8 Web API, EF Core (for data), AutoMapper (Mappings), Ocelot (API Gateway).
– JSON config files (appsettings.json, ocelot.json).
– Swagger HTTP definition files (.http) for testing/endpoints.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Clients"
        Client["Clients"]:::client
    end

    %% API Gateway
    API_Gateway["API Gateway\n(Ocelot)"]:::gateway

    %% Microservices Layer
    subgraph "Microservices"
        AssetSvc["AssetService\nASP.NET 8"]:::micro
        InvSvc["InventoryService\nASP.NET 8"]:::micro
        UserSvc["UserService\nASP.NET 8"]:::micro
        AssignSvc["AssignmentService\nASP.NET 8"]:::micro
        ReportSvc["ReportingService\nASP.NET 8"]:::micro
    end

    %% Databases
    AssetDB["Asset DB"]:::db
    InvDB["Inventory DB"]:::db
    UserDB["User DB"]:::db
    AssignDB["Assignment DB"]:::db
    ReportDB["Reporting DB"]:::db

    %% Shared Kernel
    SharedKernelLib["SharedKernel\n(Class Library)"]:::shared

    %% Client to Gateway
    Client -->|"HTTP Requests"| API_Gateway

    %% Gateway to Services
    API_Gateway -->|"routes to AssetService"| AssetSvc
    API_Gateway -->|"routes to InventoryService"| InvSvc
    API_Gateway -->|"routes to UserService"| UserSvc
    API_Gateway -->|"routes to AssignmentService"| AssignSvc
    API_Gateway -->|"routes to ReportingService"| ReportSvc

    %% Services to their Databases
    AssetSvc -->|"CRUD operations"| AssetDB
    InvSvc -->|"CRUD operations"| InvDB
    UserSvc -->|"CRUD operations"| UserDB
    AssignSvc -->|"CRUD operations"| AssignDB
    ReportSvc -->|"CRUD operations"| ReportDB

    %% Inter-service calls
    AssignSvc -->|"GET /users/{id}"| UserSvc
    AssignSvc -->|"GET /assets/{id}"| AssetSvc
    ReportSvc ---|"reads from multiple DBs"| AssetDB
    ReportSvc ---|"reads from multiple DBs"| InvDB
    ReportSvc ---|"reads from multiple DBs"| UserDB
    ReportSvc ---|"reads from multiple DBs"| AssignDB

    %% Shared Kernel usage
    SharedKernelLib --> AssetSvc
    SharedKernelLib --> InvSvc
    SharedKernelLib --> UserSvc
    SharedKernelLib --> AssignSvc
    SharedKernelLib --> ReportSvc

    %% Click Events
    click API_Gateway "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/ApiGateway/Program.cs"
    click API_Gateway "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/ApiGateway/ocelot.json"
    click API_Gateway "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/ApiGateway/ApiGateway.http"
    click AssetSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/AssetService/Program.cs"
    click AssetSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/AssetService/Controllers/AssetController.cs"
    click AssetSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/AssetService/AssetService.http"
    click InvSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/InventoryService/Program.cs"
    click InvSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/InventoryService/InventoryService.http"
    click UserSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/UserService/Program.cs"
    click UserSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/UserService/Controllers/UserController.cs"
    click UserSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/UserService/UserService.http"
    click AssignSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/AssignmentService/Program.cs"
    click AssignSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/AssignmentService/AssignmentService.http"
    click ReportSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/ReportingService/Program.cs"
    click ReportSvc "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/ReportingService/ReportingService.http"
    click SharedKernelLib "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/SharedKernel/Class1.cs"
    click SharedKernelLib "https://github.com/yamakazeankk/backend-inventory-asset-tracking-system/blob/main/SharedKernel/SharedKernel.csproj"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:1px
    classDef gateway fill:#bbdefb,stroke:#1e88e5,stroke-width:2px
    classDef micro fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
    classDef db fill:#eeeeee,stroke:#757575,stroke-width:2px,shape:cylinder
    classDef shared fill:#fff9c4,stroke:#f9a825,stroke-width:2px,stroke-dasharray: 5 5
```
