# anderj14/canastabasica architecture

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

- Interactive diagram: https://gitdiagram.com/anderj14/canastabasica
- Repository: https://github.com/anderj14/canastabasica

## Overview

##### Project type and purpose
- Canasta API is a backend‐only, minimalistic REST service written in .NET 9.
- Its primary purpose is to manage products and prices, compute economic indices (Laspeyres, Paasche, Fisher), and generate price/index charts.

##### File structure
- Top-level files:
- docker-compose.yml – brings up SQL Server in Docker.
- CanastaBasica.sln – Visual Studio solution.
- README.md – project overview.
- Canasta/Program.cs – entry point for the Minimal API.
- Canasta/Data/AppDbContext.cs + Migrations/ – Entity Framework Core data layer.
- Canasta/Models/ – domain entities (Producto, Precio, IndiceCalculado, etc.).
- appsettings.json(.Development) – configuration, including ConnectionStrings.
- Properties/launchSettings.json – debug profiles.

##### README for additional insights
- Confirms technology stack: .NET 9 Minimal API, EF Core, SQL Server in Docker, OxyPlot for PNG charts, Swagger/OpenAPI.
- Lists endpoints for CRUD, index calculation, graphics generation.

##### Detail
- Migration subsystem as a sub-component of EF Core.
- If desired, annotate version info (e.g., “.NET 9,” “EF Core 8+”) next to component names.

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Clients and Infra
    Client["Client\n(Postman/Browser)"]:::external
    DockerCompose["Docker Compose"]:::infra
    DB["SQL Server\n(Docker Container)"]:::infra

    %% Core Application
    subgraph "Core Application"
        direction TB
        %% API Layer
        API["Minimal API Layer\n(.NET 9)\nProgram.cs"]:::app
        %% Business Logic
        BL["Business Logic\nIndex Calculators & OxyPlot"]:::app
        %% Data Access Layer
        DAL["EF Core / Data Access\nAppDbContext & Migrations"]:::data
        %% Swagger UI
        Swagger["Swagger UI\n(OpenAPI Docs)"]:::app
        %% Configuration
        subgraph "Configuration"
            direction TB
            AppSettings["appsettings.json"]:::data
            DevSettings["appsettings.Development.json"]:::data
            LaunchSettings["launchSettings.json"]:::data
        end
    end

    %% Domain Models
    subgraph "Domain Models" 
        direction TB
        Producto["Producto.cs"]:::data
        Precio["Precio.cs"]:::data
        IndiceCalc["IndiceCalculado.cs"]:::data
        IndiceGrafico["IndiceGrafico.cs"]:::data
        ProductoGrafico["ProductoGrafico.cs"]:::data
        ValorAnual["ValorAnual.cs"]:::data
    end

    %% Solution and Docs
    SolFile["CanastaBasica.sln"]:::external
    Readme["README.md"]:::external

    %% Relationships
    Client -->|HTTP/JSON| API
    DockerCompose -->|orchestrates| API
    DockerCompose -->|orchestrates| DB

    API -->|routes to| BL
    API -->|uses| DAL
    API -->|serves| Swagger
    BL -->|reads/writes| DAL
    DAL -->|SQL CRUD| DB

    DAL -->|maps entities| Producto
    DAL -->|maps entities| Precio
    DAL -->|maps entities| IndiceCalc
    DAL -->|maps entities| IndiceGrafico
    DAL -->|maps entities| ProductoGrafico
    DAL -->|maps entities| ValorAnual

    API -->|loads| AppSettings
    API -->|loads| DevSettings
    API -->|loads| LaunchSettings

    SolFile -->|entrypoint| API
    Readme -->|docs| API

    %% Click Events
    click API "https://github.com/anderj14/canastabasica/blob/main/Canasta/Program.cs"
    click BL "https://github.com/anderj14/canastabasica/blob/main/Canasta/Program.cs"
    click DAL "https://github.com/anderj14/canastabasica/blob/main/Canasta/Data/AppDbContext.cs"
    click DAL "https://github.com/anderj14/canastabasica/tree/main/Canasta/Migrations/"
    click Producto "https://github.com/anderj14/canastabasica/blob/main/Canasta/Models/Producto.cs"
    click Precio "https://github.com/anderj14/canastabasica/blob/main/Canasta/Models/Precio.cs"
    click IndiceCalc "https://github.com/anderj14/canastabasica/blob/main/Canasta/Models/IndiceCalculado.cs"
    click IndiceGrafico "https://github.com/anderj14/canastabasica/blob/main/Canasta/Models/IndiceGrafico.cs"
    click ProductoGrafico "https://github.com/anderj14/canastabasica/blob/main/Canasta/Models/ProductoGrafico.cs"
    click ValorAnual "https://github.com/anderj14/canastabasica/blob/main/Canasta/Models/ValorAnual.cs"
    click AppSettings "https://github.com/anderj14/canastabasica/blob/main/Canasta/appsettings.json"
    click DevSettings "https://github.com/anderj14/canastabasica/blob/main/Canasta/appsettings.Development.json"
    click LaunchSettings "https://github.com/anderj14/canastabasica/blob/main/Canasta/Properties/launchSettings.json"
    click DockerCompose "https://github.com/anderj14/canastabasica/blob/main/docker-compose.yml"
    click SolFile "https://github.com/anderj14/canastabasica/blob/main/CanastaBasica.sln"
    click Readme "https://github.com/anderj14/canastabasica/blob/main/README.md"

    %% Styles
    classDef app fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef data fill:#ffe5cc,stroke:#333,stroke-width:1px
    classDef infra fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef external fill:#d9d9d9,stroke:#333,stroke-width:1px
```
