# jhonnydiaz4753/api_q_sp architecture

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

- Interactive diagram: https://gitdiagram.com/jhonnydiaz4753/api_q_sp
- Repository: https://github.com/jhonnydiaz4753/api_q_sp

## Overview

1. **Overall shape**
   - This is a **single Spring Boot REST API** (`QSpApplication`) organized in the classic layered pattern: **controller → service → repository → database**.
   - The application is focused on **catalog and sales management**: products, categories, ingredients, product-ingredient relationships, and sales.

2. **API boundary**
   - The main external boundary is the **HTTP REST layer** under `controller/`.
   - Controllers expose resource-specific endpoints for:
     - `AuthController`
     - `CategoryController`
     - `IngredientController`
     - `ProductController`
     - `Productingredientcontroller`
     - `SaleController`
   - This is the entry point for clients; business logic is not expected to live in controllers.

3. **Business/service layer**
   - The `service/` package is the application’s main orchestration layer.
   - Services visible in the tree:
     - `CategoryService`
     - `IngredientService`
     - `ProductService`
     - `ProductIngredientService`
     - `SaleService`
     - `LoginAttemptService`
   - These services likely coordinate validation, business rules, and repository access. `LoginAttemptService` suggests authentication hardening beyond simple login.

4. **Persistence boundary**
   - Data access is handled by Spring Data JPA repositories in `repository/`.
   - Repositories map the domain entities to PostgreSQL tables:
     - `AdminUserRepository`
     - `CategoryRepository`
     - `IngredientRepository`
     - `ProductRepository`
     - `ProductIngredientRepository`
     - `Salerepository`
   - This layer is the only one that should talk directly to the database.

5. **Domain model**
   - The `model/` package defines the persistent entities:
     - `AdminUser`
     - `Category`
     - `Ingredient`
     - `Product`
     - `ProductIngredient`
     - `Sale`
     - `SaleItem`
   - The presence of `ProductIngredient` and `SaleItem` indicates two important relational structures:
     - a **product-to-ingredient association**
     - a **sale header / sale item breakdown**

6. **DTOs and API payload shaping**
   - The `DTO/` package is used to decouple request/response shapes from the JPA entities.
   - DTOs include:
     - `SaleItemRequest`
     - `Salerequest`
     - `IngredientDTO`
     - `Dashboardstats`
     - `SalesByDayDTO`
   - These suggest the API returns specialized analytics and accepts structured sale creation payloads rather than exposing raw entities directly.

7. **Security and authentication**
   - Security is centralized in `config/`:
     - `SecurityConfig`
     - `JwtFilter`
     - `JwtUtil`
     - `CorsConfig`
   - The API uses **JWT-based authentication** and has **CORS enabled**, so the runtime is designed for cross-origin client access while protecting administrative endpoints.
   - `AuthController` is the likely login/token issuance boundary.

8. **Request flow**
   - A typical request path is:
     - client calls a controller
     - controller delegates to a service
     - service uses one or more repositories
     - repository reads/writes PostgreSQL via JPA/Hibernate
     - entities/DTOs are returned back through the controller
   - Security filters intercept requests before controller execution to validate JWTs.

9. **Database and runtime**
   - The README states the backend uses **PostgreSQL**.
   - Since this is Spring Boot with Spring Data JPA, the app depends on a relational schema that reflects the domain entities and association tables.
   - `application.properties` is the central runtime configuration file for datasource and app settings.

10. **Deployment and packaging**
   - The repo includes a **`Dockerfile`**, so the service is containerized.
   - The README mentions deployment on **Railway**, implying the app is designed to run as a stateless service backed by an external PostgreSQL instance.
   - The Maven wrapper (`mvnw`, `.mvn/`) shows builds are reproducible without requiring local Maven installation.

11. **Analytics/reporting path**
   - The DTOs `Dashboardstats` and `SalesByDayDTO`, plus `SaleController`/`SaleService`, indicate a secondary data flow for **reporting and dashboard metrics**.
   - This is separate from CRUD operations and likely aggregates sales data for read-only views.

12. **Testing**
   - The test tree is minimal, with `QSpApplicationTests`, so automated coverage appears lightweight at the moment.
   - For architecture diagrams, treat tests as a support concern rather than a major runtime subsystem.

13. **Important diagram boundaries**
   - Draw these as separate boxes:
     - **Client / HTTP consumers**
     - **Spring Boot API**
     - **Security filter chain**
     - **Controllers**
     - **Services**
     - **Repositories**
     - **PostgreSQL**
   - Optionally show **DTOs** as the contract objects crossing the controller boundary, and **domain entities** as the persistence model inside the application.

14. **What stands out in this repo**
   - The repository is not a generic CRUD app only; it has:
     - **authentication/security**
     - **inventory/catalog modeling**
     - **sales transaction modeling**
     - **dashboard/reporting DTOs**
   - That makes the architecture a small but complete backend domain service rather than a thin data API.

Main entry points: [`src/main/java/com/APIS/Q_SP/service/SaleService.java`](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/SaleService.java) (Sale Service), [`src/main/java/com/APIS/Q_SP/controller/SaleController.java`](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/SaleController.java) (Sale API), [`src/main/java/com/APIS/Q_SP/config/SecurityConfig.java`](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/config/SecurityConfig.java) (Security Config), [`src/main/java/com/APIS/Q_SP/controller/AuthController.java`](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/AuthController.java) (Auth)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boundary["Boundary"]
  node_client(("Client<br/>consumer"))
end

subgraph group_security["Security"]
  node_security_config["Security Config"]
  node_jwt_filter["JWT Filter<br/>request filter<br/>[JwtFilter.java]"]
  node_jwt_util["JWT Util<br/>token util<br/>[JwtUtil.java]"]
  node_cors_config["CORS Config<br/>web config<br/>[CorsConfig.java]"]
end

subgraph group_application["Application"]
  node_app["QSpApplication<br/>boot app"]
  node_auth_controller["Auth<br/>controller"]
  node_category_controller["Category API<br/>controller"]
  node_ingredient_controller["Ingredient API<br/>controller"]
  node_product_controller["Product API<br/>controller"]
  node_productingredient_controller["Prod-Ingred API<br/>controller"]
  node_sale_controller["Sale API<br/>controller"]
  node_category_service["Category Service"]
  node_ingredient_service["Ingredient Service"]
  node_product_service["Product Service"]
  node_productingredient_service["Prod-Ingred Service"]
  node_sale_service["Sale Service<br/>[SaleService.java]"]
  node_login_attempt_service["Login Attempts"]
  node_sale_request_dto["Sale Request<br/>dto<br/>[Salerequest.java]"]
  node_sale_item_request_dto["Sale Item Req<br/>dto"]
  node_ingredient_dto["Ingredient DTO<br/>[IngredientDTO.java]"]
  node_dashboard_stats_dto["Dashboard Stats<br/>dto"]
  node_sales_by_day_dto["Sales by Day<br/>dto<br/>[SalesByDayDTO.java]"]
end

subgraph group_persistence["Persistence"]
  node_admin_user_repo["AdminUser Repo"]
  node_category_repo["Category Repo"]
  node_ingredient_repo["Ingredient Repo"]
  node_product_repo["Product Repo"]
  node_productingredient_repo["Prod-Ingred Repo"]
  node_sale_repo["Sale Repo"]
  node_admin_user[("AdminUser<br/>entity<br/>[AdminUser.java]")]
  node_category[("Category<br/>entity<br/>[Category.java]")]
  node_ingredient[("Ingredient<br/>entity<br/>[Ingredient.java]")]
  node_product[("Product<br/>entity<br/>[Product.java]")]
  node_product_ingredient[("ProductIngredient<br/>entity")]
end

subgraph group_storage["Storage"]
end

node_client -->|"HTTP"| node_security_config
node_security_config -->|"uses"| node_jwt_filter
node_jwt_filter -->|"validates"| node_jwt_util
node_security_config -->|"enables"| node_cors_config
node_jwt_filter -->|"guards"| node_auth_controller
node_client -->|"login"| node_auth_controller
node_client -->|"calls"| node_category_controller
node_client -->|"calls"| node_ingredient_controller
node_client -->|"calls"| node_product_controller
node_client -->|"calls"| node_productingredient_controller
node_client -->|"calls"| node_sale_controller
node_auth_controller -->|"uses"| node_login_attempt_service
node_auth_controller -->|"issues token"| node_jwt_util
node_category_controller -->|"delegates"| node_category_service
node_ingredient_controller -->|"delegates"| node_ingredient_service
node_product_controller -->|"delegates"| node_product_service
node_productingredient_controller -->|"delegates"| node_productingredient_service
node_sale_controller -->|"delegates"| node_sale_service
node_sale_controller -->|"returns"| node_dashboard_stats_dto
node_sale_controller -->|"returns"| node_sales_by_day_dto
node_sale_service -->|"accepts"| node_sale_request_dto
node_sale_service -->|"accepts"| node_sale_item_request_dto
node_ingredient_controller -->|"returns"| node_ingredient_dto
node_category_service -->|"uses"| node_category_repo
node_ingredient_service -->|"uses"| node_ingredient_repo
node_product_service -->|"uses"| node_product_repo
node_productingredient_service -->|"uses"| node_productingredient_repo
node_sale_service -->|"uses"| node_sale_repo
node_login_attempt_service -->|"uses"| node_admin_user_repo
node_admin_user_repo -->|"persists"| node_admin_user
node_category_repo -->|"persists"| node_category
node_ingredient_repo -->|"persists"| node_ingredient
node_product_repo -->|"persists"| node_product
node_productingredient_repo -->|"persists"| node_product_ingredient
node_sale_repo -->|"reads"| node_product
node_sale_repo -->|"reads"| node_category
node_app -->|"boots"| node_security_config
node_app -->|"starts"| node_category_service
node_app -->|"starts"| node_sale_service

click node_app "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/QSpApplication.java"
click node_security_config "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/config/SecurityConfig.java"
click node_jwt_filter "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/config/JwtFilter.java"
click node_jwt_util "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/config/JwtUtil.java"
click node_cors_config "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/config/CorsConfig.java"
click node_auth_controller "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/AuthController.java"
click node_category_controller "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/CategoryController.java"
click node_ingredient_controller "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/IngredientController.java"
click node_product_controller "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/ProductController.java"
click node_productingredient_controller "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/Productingredientcontroller.java"
click node_sale_controller "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/SaleController.java"
click node_category_service "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/CategoryService.java"
click node_ingredient_service "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/IngredientService.java"
click node_product_service "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/ProductService.java"
click node_productingredient_service "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/ProductIngredientService.java"
click node_sale_service "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/SaleService.java"
click node_login_attempt_service "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/LoginAttemptService.java"
click node_sale_request_dto "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/Salerequest.java"
click node_sale_item_request_dto "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/SaleItemRequest.java"
click node_ingredient_dto "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/IngredientDTO.java"
click node_dashboard_stats_dto "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/Dashboardstats.java"
click node_sales_by_day_dto "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/SalesByDayDTO.java"
click node_admin_user_repo "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/AdminUserRepository.java"
click node_category_repo "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/CategoryRepository.java"
click node_ingredient_repo "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/IngredientRepository.java"
click node_product_repo "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/ProductRepository.java"
click node_productingredient_repo "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/ProductIngredientRepository.java"
click node_sale_repo "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/Salerepository.java"
click node_admin_user "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/AdminUser.java"
click node_category "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/Category.java"
click node_ingredient "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/Ingredient.java"
click node_product "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/Product.java"
click node_product_ingredient "https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/ProductIngredient.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client toneBlue
class node_security_config,node_jwt_filter,node_jwt_util,node_cors_config toneAmber
class node_app,node_auth_controller,node_category_controller,node_ingredient_controller,node_product_controller,node_productingredient_controller,node_sale_controller,node_category_service,node_ingredient_service,node_product_service,node_productingredient_service,node_sale_service,node_login_attempt_service,node_sale_request_dto,node_sale_item_request_dto,node_ingredient_dto,node_dashboard_stats_dto,node_sales_by_day_dto toneMint
class node_admin_user_repo,node_category_repo,node_ingredient_repo,node_product_repo,node_productingredient_repo,node_sale_repo,node_admin_user,node_category,node_ingredient,node_product,node_product_ingredient toneRose
```

## Components

### Boundary

External request and API entry points

- **Client**: consumer · HTTP clients consuming the API

### Security

JWT auth, CORS, and filter chain

- [Security Config](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/config/SecurityConfig.java): security config · Main HTTP security configuration · `src/main/java/com/APIS/Q_SP/config/SecurityConfig.java`
- [JWT Filter](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/config/JwtFilter.java): request filter · Validates tokens on incoming requests · `src/main/java/com/APIS/Q_SP/config/JwtFilter.java`
- [JWT Util](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/config/JwtUtil.java): token util · Creates and validates JWTs · `src/main/java/com/APIS/Q_SP/config/JwtUtil.java`
- [CORS Config](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/config/CorsConfig.java): web config · Cross-origin access settings · `src/main/java/com/APIS/Q_SP/config/CorsConfig.java`

### Application

Spring Boot runtime, controllers, services, and DTO contracts

- [QSpApplication](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/QSpApplication.java): boot app · Spring Boot entry point · `src/main/java/com/APIS/Q_SP/QSpApplication.java`
- [Auth](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/AuthController.java): controller · Login and auth boundary · `src/main/java/com/APIS/Q_SP/controller/AuthController.java`
- [Category API](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/CategoryController.java): controller · Category endpoints · `src/main/java/com/APIS/Q_SP/controller/CategoryController.java`
- [Ingredient API](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/IngredientController.java): controller · Ingredient endpoints · `src/main/java/com/APIS/Q_SP/controller/IngredientController.java`
- [Product API](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/ProductController.java): controller · Product endpoints · `src/main/java/com/APIS/Q_SP/controller/ProductController.java`
- [Prod-Ingred API](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/Productingredientcontroller.java): controller · Product-ingredient endpoints · `src/main/java/com/APIS/Q_SP/controller/Productingredientcontroller.java`
- [Sale API](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/controller/SaleController.java): controller · Sales and reporting endpoints · `src/main/java/com/APIS/Q_SP/controller/SaleController.java`
- [Category Service](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/CategoryService.java): service · Category business rules · `src/main/java/com/APIS/Q_SP/service/CategoryService.java`
- [Ingredient Service](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/IngredientService.java): service · Ingredient business rules · `src/main/java/com/APIS/Q_SP/service/IngredientService.java`
- [Product Service](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/ProductService.java): service · Product orchestration · `src/main/java/com/APIS/Q_SP/service/ProductService.java`
- [Prod-Ingred Service](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/ProductIngredientService.java): service · Product-ingredient coordination · `src/main/java/com/APIS/Q_SP/service/ProductIngredientService.java`
- [Sale Service](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/SaleService.java): service · Sale processing and reporting · `src/main/java/com/APIS/Q_SP/service/SaleService.java`
- [Login Attempts](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/service/LoginAttemptService.java): service · Login hardening and retry tracking · `src/main/java/com/APIS/Q_SP/service/LoginAttemptService.java`
- [Sale Request](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/Salerequest.java): dto · Sale creation payload · `src/main/java/com/APIS/Q_SP/DTO/Salerequest.java`
- [Sale Item Req](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/SaleItemRequest.java): dto · Sale item payload · `src/main/java/com/APIS/Q_SP/DTO/SaleItemRequest.java`
- [Ingredient DTO](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/IngredientDTO.java): dto · API-friendly ingredient shape · `src/main/java/com/APIS/Q_SP/DTO/IngredientDTO.java`
- [Dashboard Stats](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/Dashboardstats.java): dto · Aggregated sales metrics · `src/main/java/com/APIS/Q_SP/DTO/Dashboardstats.java`
- [Sales by Day](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/DTO/SalesByDayDTO.java): dto · Daily sales report shape · `src/main/java/com/APIS/Q_SP/DTO/SalesByDayDTO.java`

### Persistence

JPA repositories and domain entities

- [AdminUser Repo](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/AdminUserRepository.java): repository · Admin user access · `src/main/java/com/APIS/Q_SP/repository/AdminUserRepository.java`
- [Category Repo](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/CategoryRepository.java): repository · Category persistence · `src/main/java/com/APIS/Q_SP/repository/CategoryRepository.java`
- [Ingredient Repo](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/IngredientRepository.java): repository · Ingredient persistence · `src/main/java/com/APIS/Q_SP/repository/IngredientRepository.java`
- [Product Repo](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/ProductRepository.java): repository · Product persistence · `src/main/java/com/APIS/Q_SP/repository/ProductRepository.java`
- [Prod-Ingred Repo](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/ProductIngredientRepository.java): repository · Product-ingredient persistence · `src/main/java/com/APIS/Q_SP/repository/ProductIngredientRepository.java`
- [Sale Repo](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/repository/Salerepository.java): repository · Sale persistence · `src/main/java/com/APIS/Q_SP/repository/Salerepository.java`
- [AdminUser](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/AdminUser.java): entity · Authenticated admin account · `src/main/java/com/APIS/Q_SP/model/AdminUser.java`
- [Category](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/Category.java): entity · Product category · `src/main/java/com/APIS/Q_SP/model/Category.java`
- [Ingredient](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/Ingredient.java): entity · Stock ingredient · `src/main/java/com/APIS/Q_SP/model/Ingredient.java`
- [Product](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/Product.java): entity · Catalog product · `src/main/java/com/APIS/Q_SP/model/Product.java`
- [ProductIngredient](https://github.com/jhonnydiaz4753/api_q_sp/blob/main/src/main/java/com/APIS/Q_SP/model/ProductIngredient.java): entity · Product-to-ingredient link · `src/main/java/com/APIS/Q_SP/model/ProductIngredient.java`

## Connections

- Client → Security Config: HTTP · Requests enter through the secured API boundary
- Security Config → JWT Filter: uses · Security chain installs the JWT filter
- JWT Filter → JWT Util: validates · Filter relies on token helpers
- Security Config → CORS Config: enables · CORS policy is applied to the API
- JWT Filter → Auth: guards · Protected endpoints pass through JWT validation
- Client → Auth: login · Authentication requests reach the auth controller
- Client → Category API: calls · Client CRUD traffic reaches resource controllers
- Client → Ingredient API: calls · Client CRUD traffic reaches resource controllers
- Client → Product API: calls · Client CRUD traffic reaches resource controllers
- Client → Prod-Ingred API: calls · Client CRUD traffic reaches resource controllers
- Client → Sale API: calls · Client sales and reporting requests reach the API
- Auth → Login Attempts: uses · Login flow tracks attempts and lockouts
- Auth → JWT Util: issues token · Authentication returns JWTs
- Category API → Category Service: delegates · Controller forwards category operations
- Ingredient API → Ingredient Service: delegates · Controller forwards ingredient operations
- Product API → Product Service: delegates · Controller forwards product operations
- Prod-Ingred API → Prod-Ingred Service: delegates · Controller forwards product-ingredient operations
- Sale API → Sale Service: delegates · Controller forwards sales and reporting operations
- Sale API → Dashboard Stats: returns · Dashboard aggregates are shaped as DTOs
- Sale API → Sales by Day: returns · Daily reports are shaped as DTOs
- Sale Service → Sale Request: accepts · Sale creation uses request DTOs
- Sale Service → Sale Item Req: accepts · Sale item payloads are part of the request shape
- Ingredient API → Ingredient DTO: returns · Ingredient responses are decoupled from entities
- Category Service → Category Repo: uses · Category service reads/writes through JPA
- Ingredient Service → Ingredient Repo: uses · Ingredient service reads/writes through JPA
- Product Service → Product Repo: uses · Product service reads/writes through JPA
- Prod-Ingred Service → Prod-Ingred Repo: uses · Product-ingredient service reads/writes through JPA
- Sale Service → Sale Repo: uses · Sale service reads/writes through JPA
- Login Attempts → AdminUser Repo: uses · Login tracking relies on admin user persistence
- AdminUser Repo → AdminUser: persists · Repository maps the admin user entity
- Category Repo → Category: persists · Repository maps the category entity
- Ingredient Repo → Ingredient: persists · Repository maps the ingredient entity
- Product Repo → Product: persists · Repository maps the product entity
- Prod-Ingred Repo → ProductIngredient: persists · Repository maps the join entity
- Sale Repo → Product: reads · Sales workflows likely depend on product data
- Sale Repo → Category: reads · Reporting and sale processing can reference catalog grouping
- QSpApplication → Security Config: boots · Application startup wires the security layer
- QSpApplication → Category Service: starts · Spring Boot loads application services
- QSpApplication → Sale Service: starts · Spring Boot loads application services
