# kishorekanchi/computerstoragesolutions architecture

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

- Interactive diagram: https://gitdiagram.com/kishorekanchi/computerstoragesolutions
- Repository: https://github.com/kishorekanchi/computerstoragesolutions

## Overview

##### Main Components
- Frontend (ComputerStorageSolutionsUI): This folder is dedicated to the Angular application. It contains multiple Angular components, services, assets, and configuration files. Notable directories include:
- /src/app: Encompasses various Angular components such as loginpage, signuppage, nav-bar, productpage, add-productpage, cartpage, orderspage, statistics, etc.
- /src/app/Services: Contains API service interactions, cookie management, and user detail handling.
- Angular-specific configuration and build files (angular.json, package.json, tsconfig.*.json).
- Backend (ComputerStorageSolutionsWebApi): This is the server-side component handling business logic and API endpoints. It includes:
- Controllers: Responsible for the API endpoints (e.g., ProductsController, CartController, LoginController, etc.).
- Models: Represent domain entities like Products, Users, Orders, etc.
- Services: Including token and JWT creation services, which handle security and authentication.
- Middleware: ExceptionHandlingMiddleware for managing errors.
- Program.cs and project configuration files (csproj, appsettings.json) that dictate the API’s startup behavior.
- Database: The Database directory holds the SQL Server files (.mdf, .ldf) along with a SQL script, which implies usage of a local SQL Server or similar RDBMS for data persistence.

##### Relationships and Interactions
- The Angular frontend communicates with the ASP.NET Web API using HTTP requests. The API endpoints exposed by various controllers respond to these requests.
- Services within the Angular application (e.g., api-service.service.ts) encapsulate the communication details with the backend, handling tasks such as user authentication (likely using jwt-decode) and data fetching.
- The backend controllers perform CRUD operations on the database, interacting with Models that represent data structures stored in the SQL database.
- Security and authentication are implemented using JWT (with services like JwtCreationService and TokenService) ensuring secure data exchange.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Clearly delineating the frontend (UI and client-side logic) from the backend (API, business logic, data access), upholding modularity.
- MVC (Model-View-Controller) Pattern on the backend: Controllers handle HTTP requests, Models represent data, and the service layer processes business logic.
- RESTful API principles: The backend controllers are structured to act as REST APIs.
- Service abstraction on the frontend: Angular services abstract away API calls from the component logic.
- Error Handling Middleware: A centralized approach to capture and handle exceptions across the web API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        FE1["Angular Application"]:::frontend
        FE2["Angular Components (UI Pages)"]:::frontend
        FE3["Angular Services (API interactions)"]:::frontend
    end

    subgraph "Backend Layer"
        BE1["ASP.NET Web API"]:::backend
        BE2["Controllers (Products, Login, ExceptionHandlingMiddleware)"]:::backend
        BE3["Models (Products, Users, Orders)"]:::backend
        BE4["Services (JWT Creation, Token Handling)"]:::backend
        BE5["Startup Configuration (Program.cs, csproj)"]:::backend
    end

    subgraph "Database"
        DB["SQL Database"]:::database
    end

    FE1 -->|"renders"| FE2
    FE1 -->|"manages"| FE3
    FE3 -->|"HTTPRequests"| BE1
    BE1 -->|"routesTo"| BE2
    BE2 -->|"usesModels"| BE3
    BE2 -->|"callsServices"| BE4
    BE2 -->|"CRUDoperations"| DB

    click FE1 "https://github.com/kishorekanchi/computerstoragesolutions/tree/main/ComputerStorageSolutionsUI"
    click FE2 "https://github.com/kishorekanchi/computerstoragesolutions/tree/main/ComputerStorageSolutionsUI/src/app"
    click FE3 "https://github.com/kishorekanchi/computerstoragesolutions/tree/main/ComputerStorageSolutionsUI/src/app/Services"

    click BE1 "https://github.com/kishorekanchi/computerstoragesolutions/tree/main/ComputerStorageSolutionsWebApi"
    click BE2 "https://github.com/kishorekanchi/computerstoragesolutions/tree/main/ComputerStorageSolutionsWebApi/Controllers"
    click BE3 "https://github.com/kishorekanchi/computerstoragesolutions/tree/main/ComputerStorageSolutionsWebApi/Models"
    click BE4 "https://github.com/kishorekanchi/computerstoragesolutions/tree/main/ComputerStorageSolutionsWebApi/Services"
    click BE5 "https://github.com/kishorekanchi/computerstoragesolutions/blob/main/ComputerStorageSolutionsWebApi/Program.cs"

    click DB "https://github.com/kishorekanchi/computerstoragesolutions/tree/main/Database"

    classDef frontend fill:#add8e6,stroke:#0b3d91,stroke-width:2px;
    classDef backend fill:#98fb98,stroke:#228b22,stroke-width:2px;
    classDef database fill:#ffa07a,stroke:#cd5c5c,stroke-width:2px;
```
