# alonsolmz/algyestdatos-proyectocompleto architecture

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

- Interactive diagram: https://gitdiagram.com/alonsolmz/algyestdatos-proyectocompleto
- Repository: https://github.com/alonsolmz/algyestdatos-proyectocompleto

## Overview

1. This repository is split into two independently run applications: a Java/Spring backend in `backend/` and an Astro-based frontend in `frontend/`. The backend provides the domain logic and persistence; the frontend provides the user interface.

2. The backend is a Spring Boot application (`Grupo02Application.java`) built with Maven. Its package layout follows a standard layered architecture: `controller` → `service` → `repository` → `model`, with DTO and mapper layers in between.

3. The core domain is inventory/order management. The main entities are `Almacen`, `Cliente`, `Producto`, `Ubicacion`, `Pedido`, `DetallePedido`, and `MovimientoStock`. These represent warehouses, customers, products, locations, orders, order lines, and stock movements.

4. REST endpoints are organized by domain area through separate controllers for each entity. These controllers are the HTTP boundary of the system and are responsible for exposing CRUD-style operations and delegating work to services.

5. Business logic is concentrated in the `service` layer, with concrete implementations under `service/impl`. This layer is where validations, orchestration, and domain-specific operations belong, rather than in controllers or repositories.

6. Persistence is handled through one repository interface per aggregate/entity in `repository/`. The presence of `data.sql` in `src/main/resources` indicates the backend starts with seed data, so the application likely supports preloaded sample records for development/demo use.

7. The API does not expose JPA entities directly. Instead, the project uses DTOs (`dto/`) and mapper classes (`dto/mapper/`) to convert between API payloads and internal model objects. This is an important boundary for the architecture diagram because it separates transport concerns from persistence/domain concerns.

8. There is a custom data-structures package under `structure/` containing `ListaPedidos`, `NodoPedido`, and `OperacionesLista`. This is notable for an algorithms/data-structures project: orders are not only persisted in the database, but there is also an in-memory custom list structure used for specific order operations or demonstrations.

9. The frontend is an Astro application with a small component/layout/page structure. It has a dashboard layout, a product form component, a home page, and a `RegistroProducto` page, which suggests the UI is focused on product registration and a lightweight dashboard experience.

10. The frontend and backend are separated at the repository level and communicate over HTTP rather than sharing code. In the architecture diagram, treat the frontend as a client consuming the backend’s REST API.

11. Testing exists on the backend side, including application tests and service tests for `ProductoServiceImpl`. That indicates the service layer is an important test boundary and likely the most business-critical part of the backend.

12. Operationally, the backend is meant to be run from the Maven wrapper/IDE, while the frontend is run with `npm run dev`. The project therefore has two runtimes: Java for API/business logic and Node/Astro for the presentation layer.

Main entry points: [`frontend/src`](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/frontend/src) (Astro app), [`backend/src/main/java/pe/edu/pe/Grupo02/controller`](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/controller) (REST controllers), [`backend/src/main/java/pe/edu/pe/Grupo02/service/impl`](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/service/impl) (Service impls), [`backend/src/main/java/pe/edu/pe/Grupo02/repository`](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/repository) (Repositories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend"]
  node_backend_app(("Spring Boot app<br/>runtime"))
  node_backend_controller["REST controllers<br/>http layer"]
  node_backend_service["Service layer<br/>business logic"]
  node_backend_service_impl["Service impls<br/>business logic"]
  node_backend_repository["Repositories<br/>persistence"]
  node_backend_model[("Domain models<br/>entities")]
  node_backend_dto["DTOs<br/>transport"]
  node_backend_mapper["Mappers<br/>translation"]
  node_backend_structure["Order list<br/>custom structure"]
  node_backend_seed["Seed data<br/>bootstrap data<br/>[data.sql]"]
  node_backend_tests["Backend tests<br/>test suite"]
end

subgraph group_frontend["Frontend"]
  node_frontend_app(("Astro app<br/>runtime"))
  node_frontend_layout["Dashboard layout<br/>ui shell"]
  node_frontend_components["Product form<br/>ui component"]
  node_frontend_pages["Pages"]
end

node_backend_app -->|"starts HTTP API"| node_backend_controller
node_backend_controller -->|"delegates"| node_backend_service
node_backend_service -->|"implemented by"| node_backend_service_impl
node_backend_service_impl -->|"reads/writes"| node_backend_repository
node_backend_repository -->|"maps entities"| node_backend_model
node_backend_controller -->|"accepts/returns"| node_backend_dto
node_backend_dto -->|"translated by"| node_backend_mapper
node_backend_mapper -->|"maps to model"| node_backend_model
node_backend_service_impl -->|"uses"| node_backend_structure
node_backend_seed -.->|"preloads"| node_backend_repository
node_backend_tests -.->|"verifies"| node_backend_service_impl
node_frontend_app -->|"composes"| node_frontend_layout
node_frontend_app -->|"renders"| node_frontend_components
node_frontend_app -->|"routes"| node_frontend_pages
node_frontend_pages -->|"uses"| node_frontend_components
node_frontend_app -.->|"calls API"| node_backend_controller

click node_backend_app "https://github.com/alonsolmz/algyestdatos-proyectocompleto/blob/main/backend/src/main/java/pe/edu/pe/Grupo02/Grupo02Application.java"
click node_backend_controller "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/controller"
click node_backend_service "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/service"
click node_backend_service_impl "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/service/impl"
click node_backend_repository "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/repository"
click node_backend_model "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/model"
click node_backend_dto "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/dto"
click node_backend_mapper "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/dto/mapper"
click node_backend_structure "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/structure"
click node_backend_seed "https://github.com/alonsolmz/algyestdatos-proyectocompleto/blob/main/backend/src/main/resources/data.sql"
click node_backend_tests "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/test/java/pe/edu/pe/Grupo02"
click node_frontend_app "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/frontend/src"
click node_frontend_layout "https://github.com/alonsolmz/algyestdatos-proyectocompleto/blob/main/frontend/src/layouts/DashboardLayout.astro"
click node_frontend_components "https://github.com/alonsolmz/algyestdatos-proyectocompleto/blob/main/frontend/src/components/FormularioProducto.astro"
click node_frontend_pages "https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/frontend/src/pages"

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_backend_app,node_backend_controller,node_backend_service,node_backend_service_impl,node_backend_repository,node_backend_model,node_backend_dto,node_backend_mapper,node_backend_structure,node_backend_seed,node_backend_tests toneBlue
class node_frontend_app,node_frontend_layout,node_frontend_components,node_frontend_pages toneAmber
```

## Components

### Backend

Spring Boot API, domain logic, persistence, and custom data structures.

- [Spring Boot app](https://github.com/alonsolmz/algyestdatos-proyectocompleto/blob/main/backend/src/main/java/pe/edu/pe/Grupo02/Grupo02Application.java): runtime · Application entrypoint and overall backend bootstrap. · `backend/src/main/java/pe/edu/pe/Grupo02/Grupo02Application.java`
- [REST controllers](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/controller): http layer · HTTP boundary exposing CRUD-style endpoints for each domain area. · `backend/src/main/java/pe/edu/pe/Grupo02/controller`
- [Service layer](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/service): business logic · Interfaces defining orchestration and domain operations. · `backend/src/main/java/pe/edu/pe/Grupo02/service`
- [Service impls](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/service/impl): business logic · Concrete validation, coordination, and use-case implementation. · `backend/src/main/java/pe/edu/pe/Grupo02/service/impl`
- [Repositories](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/repository): persistence · Repository interfaces for database access per aggregate/entity. · `backend/src/main/java/pe/edu/pe/Grupo02/repository`
- [Domain models](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/model): entities · Core inventory and order entities used internally and persisted. · `backend/src/main/java/pe/edu/pe/Grupo02/model`
- [DTOs](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/dto): transport · API payload models separating transport from domain entities. · `backend/src/main/java/pe/edu/pe/Grupo02/dto`
- [Mappers](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/dto/mapper): translation · Converts between DTOs and domain/model objects. · `backend/src/main/java/pe/edu/pe/Grupo02/dto/mapper`
- [Order list](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/main/java/pe/edu/pe/Grupo02/structure): custom structure · In-memory custom list structure for order-related operations. · `backend/src/main/java/pe/edu/pe/Grupo02/structure`
- [Seed data](https://github.com/alonsolmz/algyestdatos-proyectocompleto/blob/main/backend/src/main/resources/data.sql): bootstrap data · Initial sample records loaded at startup for development/demo use. · `backend/src/main/resources/data.sql`
- [Backend tests](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/backend/src/test/java/pe/edu/pe/Grupo02): test suite · Application and service tests, especially around Producto services. · `backend/src/test/java/pe/edu/pe/Grupo02`

### Frontend

Astro UI consumed over HTTP by the backend API.

- [Astro app](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/frontend/src): runtime · Frontend application runtime and build entrypoint. · `frontend/src`
- [Dashboard layout](https://github.com/alonsolmz/algyestdatos-proyectocompleto/blob/main/frontend/src/layouts/DashboardLayout.astro): ui shell · Shared layout framing the frontend experience. · `frontend/src/layouts/DashboardLayout.astro`
- [Product form](https://github.com/alonsolmz/algyestdatos-proyectocompleto/blob/main/frontend/src/components/FormularioProducto.astro): ui component · Reusable form component centered on product registration. · `frontend/src/components/FormularioProducto.astro`
- [Pages](https://github.com/alonsolmz/algyestdatos-proyectocompleto/tree/main/frontend/src/pages): ui pages · Public routes for home and product registration screens. · `frontend/src/pages`

## Connections

- Spring Boot app → REST controllers: starts HTTP API · Bootstraps controllers as the REST entrypoint.
- REST controllers → Service layer: delegates · Controllers pass requests to service interfaces.
- Service layer → Service impls: implemented by · Service contracts are fulfilled by concrete implementations.
- Service impls → Repositories: reads/writes · Business logic persists and loads data through repositories.
- Repositories → Domain models: maps entities · Repositories operate on the domain model layer.
- REST controllers → DTOs: accepts/returns · API contracts are defined with DTOs rather than entities.
- DTOs → Mappers: translated by · DTOs are converted to and from internal model objects.
- Mappers → Domain models: maps to model · Mappers connect transport objects to domain entities.
- Service impls → Order list: uses · Order workflows also use a custom in-memory list structure.
- Seed data → Repositories: preloads · Seed data initializes repository-backed sample records.
- Backend tests → Service impls: verifies · Service tests focus on business rules and orchestration.
- Astro app → Dashboard layout: composes · The Astro app uses a shared dashboard shell.
- Astro app → Product form: renders · Pages compose reusable UI components.
- Astro app → Pages: routes · Route-level pages define the user-facing screens.
- Pages → Product form: uses · Pages reuse the product form component.
- Astro app → REST controllers: calls API · Frontend consumes the backend over HTTP.
