# jabv123/inventario-api-web architecture

> Architecture diagram of the GitHub repository jabv123/inventario-api-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jabv123/inventario-api-web
- Repository: https://github.com/jabv123/inventario-api-web

## Overview

##### Project type and purpose
- This is a standalone Java-based RESTful API (no separate frontend) for managing an inventory of products, categories, clients, providers and product images.
- It uses the Spark Java micro-framework to define HTTP routes and handle requests on port 8080.

##### File structure
- Top-level files:
- pom.xml (Maven build)
- readme.md
- src/main/java/org/apirest/
- Main.java: boots Spark, registers routes.
- Controllers/: HTTP handlers, one per resource (ClienteController, ProductoController, etc.).
- service/: business-logic layer (ClienteService, ImgProductoService, UsuarioService).
- repository/: data-access layer (ClienteRepo, ImgProductoRepo, UsuarioRepo).
- modelo/: domain entities/DTOs (Cliente, Producto, Proveedor, Usuario, Mensaje, etc.).

##### README
- Describes endpoints, request/response formats, and the Spark server entrypoint.
- No mention of a UI: clients use Postman or any HTTP client.

## Diagram (Mermaid)

```mermaid
flowchart TB
    HTTPClient["HTTP Client"]:::http
    SparkServer["Spark Server\n(Main.java)"]:::http

    subgraph "Controller Layer"
        CategoriaController["CategoriaController"]:::controller
        ClienteController["ClienteController"]:::controller
        ImgProductoController["ImgProductoController"]:::controller
        ProductoController["ProductoController"]:::controller
        ProveedorController["ProveedorController"]:::controller
        UsuarioController["UsuarioController"]:::controller
    end

    subgraph "Service Layer"
        ClienteService["ClienteService"]:::service
        ImgProductoService["ImgProductoService"]:::service
        UsuarioService["UsuarioService"]:::service
    end

    subgraph "Repository Layer"
        ClienteRepo["ClienteRepo"]:::repo
        ImgProductoRepo["ImgProductoRepo"]:::repo
        UsuarioRepo["UsuarioRepo"]:::repo
    end

    Database[(Database)]:::db

    HTTPClient -->|"HTTP Request"| SparkServer
    SparkServer -->|"routes to Controllers"| CategoriaController
    SparkServer --> ClienteController
    SparkServer --> ImgProductoController
    SparkServer --> ProductoController
    SparkServer --> ProveedorController
    SparkServer --> UsuarioController

    CategoriaController -->|"calls Service"| ClienteService
    ClienteController --> ClienteService
    ImgProductoController --> ImgProductoService
    ProductoController --> ImgProductoService
    ProveedorController --> UsuarioService
    UsuarioController --> UsuarioService

    ClienteService -->|"uses Repo"| ClienteRepo
    ImgProductoService --> ImgProductoRepo
    UsuarioService --> UsuarioRepo

    ClienteRepo -->|"CRUD Operations"| Database
    ImgProductoRepo --> Database
    UsuarioRepo --> Database

    click SparkServer "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/Main.java"
    click CategoriaController "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/Controllers/CategoriaController.java"
    click ClienteController "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/Controllers/ClienteController.java"
    click ImgProductoController "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/Controllers/ImgProductoController.java"
    click ProductoController "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/Controllers/ProductoController.java"
    click ProveedorController "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/Controllers/ProveedorController.java"
    click UsuarioController "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/Controllers/UsuarioController.java"
    click ClienteService "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/service/ClienteService.java"
    click ImgProductoService "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/service/ImgProductoService.java"
    click UsuarioService "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/service/UsuarioService.java"
    click ClienteRepo "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/repository/ClienteRepo.java"
    click ImgProductoRepo "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/repository/ImgProductoRepo.java"
    click UsuarioRepo "https://github.com/jabv123/inventario-api-web/blob/Developer-Junior/src/main/java/org/apirest/repository/UsuarioRepo.java"

    classDef http fill:#ADD8E6,stroke:#000
    classDef controller fill:#90EE90,stroke:#000
    classDef service fill:#FFA500,stroke:#000
    classDef repo fill:#FFFF00,stroke:#000
    classDef db fill:#D3D3D3,stroke:#000
```
