# tamuzur/furnitureweb architecture

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

- Interactive diagram: https://gitdiagram.com/tamuzur/furnitureweb
- Repository: https://github.com/tamuzur/furnitureweb

## Overview

##### Project Overview
- This is a backend REST API built with C# and ASP.NET Core 8.
- It uses Entity Framework Core as its ORM and interacts with a SQLite database.
- The API provides standard CRUD operations through clearly defined endpoints for different furniture-related operations.

##### Identifying Key Components
- API Layer:
- The "Endpoints" directory contains the controllers (e.g., FTypesEndpoints.cs, FurnitureEndpoints.cs) which handle incoming HTTP requests.
- Data Access Layer:
- The "Data" directory holds the DbContext (FurnitureStoreContext.cs) and migration files that manage database schema evolution.
- It also contains data extension and configuration code via DataExtensions.cs.
- Domain Layer:
- The "Entities" folder defines the core models (Furniture.cs and FType.cs) representing your domain.
- DTOs (Data Transfer Objects):
- The "Dtos" folder provides lightweight objects (like FurnitureDto, CreateFurnitureDto, FurnitureDetailsDto, etc.) for data transfer between client and server, decoupling the API contracts from the internal domain models.
- Mapping:
- The "Mapping" folder (with classes like FurnitureMapping.cs and FTypeMapping.cs) likely contains code (e.g., AutoMapper profiles) to convert between Entities and DTOs.
- Configuration & Startup:
- The Program.cs file (along with appsettings.json and launchSettings.json) provides the application’s startup configuration, dependency injection, middleware setup, and environment-specific settings.
- Persistence:
- The SQLite database file (FurnitureStore.db) is the underlying data store that EF Core uses via the DbContext.

##### Relationships and Data Flow
- These endpoints convert or validate requests and interact with the mapping layer to convert DTOs into domain models.
- The domain models are then processed by the DbContext in the Data Access Layer (with migrations ensuring the schema is up-to-date).
- The results (or affected data) are then converted back (using mapping) and returned as DTOs.

##### Architectural Patterns and Principles
- The project follows RESTful principles for its API.
- There is a clear separation of concerns:
- Endpoint handlers manage request/response.
- DTOs ensure API contracts are maintained without leaking internal domain logic.
- EF Core acts as the persistence mechanism ready for future scalability.
- A layered architecture is evident (API layer, Data/ORM layer, Domain/Entities layer, and Mapping/Transformation layer).

##### Technologies, Tools, and Libraries
- ASP.NET Core 8 – for building the web API.
- Entity Framework Core – for ORM and database migrations.
- SQLite – as the relational database.
- (Potentially) AutoMapper or similar mapping techniques in the “Mapping” folder.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["Client/Consumer"]:::client

    subgraph "API Layer"
        Config["Configuration & Startup (Program.cs, appsettings.json, launchSettings.json)"]:::config
        Endpoints["API Endpoints (Controllers)"]:::api
    end

    subgraph "Business Logic Layer"
        DTOs["DTOs"]:::dtos
        Mapping["Mapping Layer (AutoMapper Profiles)"]:::mapping
    end

    subgraph "Domain & Data Access Layer"
        Entities["Domain Models (Entities)"]:::entities
        DataAccess["Data Access (DbContext & Migrations)"]:::dataAccess
    end

    Database["SQLite Database"]:::database

    Client -->|"HTTP_Request"| Endpoints
    Config -->|"Configures"| Endpoints
    Endpoints -->|"Uses_DTOs"| DTOs
    Endpoints -->|"Invokes_Mapping"| Mapping
    DTOs -->|"Transforms_to"| Mapping
    Mapping -->|"Converts_to"| Entities
    Entities -->|"Processed_by"| DataAccess
    DataAccess -->|"CRUD_operations"| Database
    Database -->|"Data_Retrieval"| DataAccess

    click Endpoints "https://github.com/tamuzur/furnitureweb/tree/main/FurnitureStore.api/Endpoints"
    click Config "https://github.com/tamuzur/furnitureweb/blob/main/FurnitureStore.api/Program.cs"
    click DataAccess "https://github.com/tamuzur/furnitureweb/tree/main/FurnitureStore.api/Data"
    click Entities "https://github.com/tamuzur/furnitureweb/tree/main/FurnitureStore.api/Entities"
    click DTOs "https://github.com/tamuzur/furnitureweb/tree/main/FurnitureStore.api/Dtos"
    click Mapping "https://github.com/tamuzur/furnitureweb/tree/main/FurnitureStore.api/Mapping"
    click Database "https://github.com/tamuzur/furnitureweb/blob/main/FurnitureStore.api/FurnitureStore.db"

    classDef client fill:#ccf,stroke:#333,stroke-width:2px;
    classDef api fill:#b3e5fc,stroke:#0277bd,stroke-width:2px;
    classDef config fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef dtos fill:#fff9c4,stroke:#fbc02d,stroke-width:2px;
    classDef mapping fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px;
    classDef entities fill:#e1bee7,stroke:#8e24aa,stroke-width:2px;
    classDef dataAccess fill:#d1c4e9,stroke:#5e35b1,stroke-width:2px;
    classDef database fill:#ffccbc,stroke:#d84315,stroke-width:2px;
```
