# antonny890/libreria-universal-fronted-backend-v3 architecture

> Architecture diagram of the GitHub repository antonny890/libreria-universal-fronted-backend-v3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/antonny890/libreria-universal-fronted-backend-v3
- Repository: https://github.com/antonny890/libreria-universal-fronted-backend-v3

## Overview

Librería Universal combina una tienda y catálogo React con una API REST Laravel respaldada por MySQL. El flujo principal es explorar y filtrar libros, consultar detalles y, para usuarios autorizados, gestionar libros y categorías; el frontend usa la API para catálogo, autenticación y administración. El carrito y el checkout son demostrativos y permanecen en estado local. La API también ofrece préstamos y gestión de usuarios, aunque el README indica que no todas esas operaciones están integradas en la interfaz. Las relaciones backend no visibles en fragmentos se limitan a referencias del índice o documentación.

Main entry points: [`src/App.tsx`](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/App.tsx) (Aplicación), [`backend/routes/api.php`](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/routes/api.php) (Rutas REST), [`src/context/LibraryContext.tsx`](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/context/LibraryContext.tsx) (Estado de biblioteca), [`src/lib/api.ts`](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/lib/api.ts) (Cliente API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Experiencia web"]
  node_app["Aplicación<br/>[App.tsx]"]
  node_catalog["Catálogo y destacados<br/>[CatalogSection.tsx]"]
  node_book_detail["Detalle de libro"]
  node_admin_ui["Panel administrativo<br/>[AdminDashboard.tsx]"]
  node_book_form["Formulario de libro<br/>[BookFormModal.tsx]"]
  node_auth_ui["Acceso de usuario<br/>[AuthModal.tsx]"]
  node_cart["Carrito local<br/>[CartDrawer.tsx]"]
  node_checkout["Checkout demostrativo<br/>[CheckoutModal.tsx]"]
end

subgraph group_state["Estado e integración"]
  node_context["Estado de biblioteca<br/>[LibraryContext.tsx]"]
  node_api_client["Cliente API<br/>[api.ts]"]
  node_mock["Datos iniciales<br/>[mockData.ts]"]
end

subgraph group_api["API y dominio"]
  node_api_routes["Rutas REST<br/>[api.php]"]
  node_auth_api["Autenticación API<br/>[AuthController.php]"]
  node_book_api["API de libros<br/>[BookController.php]"]
  node_category_api["API de categorías"]
  node_loan_api["API de préstamos<br/>[LoanController.php]"]
  node_user_api["API de usuarios<br/>[UserController.php]"]
  node_auth_service["Servicio de autenticación<br/>[AuthService.php]"]
  node_book_service["Servicio de libros<br/>[BookService.php]"]
  node_loan_service["Servicio de préstamos<br/>[LoanService.php]"]
  node_user_service["Servicio de usuarios<br/>[UserService.php]"]
end

subgraph group_data["Persistencia"]
  node_category_repo["Repositorio categorías"]
  node_mysql[("MySQL")]
end

node_visitor(("Visitante"))

node_visitor -->|"uses"| node_app
node_app -->|"renders"| node_catalog
node_app -->|"renders"| node_admin_ui
node_app -->|"renders"| node_book_detail
node_app -->|"renders"| node_book_form
node_app -->|"renders"| node_auth_ui
node_app -->|"renders"| node_cart
node_app -->|"renders"| node_checkout
node_app -->|"provides state"| node_context
node_context -->|"loads defaults"| node_mock
node_context -->|"calls"| node_api_client
node_visitor -.->|"requests"| node_api_client
node_api_client -->|"sends requests"| node_api_routes
node_api_routes -->|"routes"| node_auth_api
node_api_routes -->|"routes"| node_book_api
node_api_routes -->|"routes"| node_category_api
node_api_routes -->|"routes"| node_loan_api
node_api_routes -->|"routes"| node_user_api
node_auth_api -->|"delegates"| node_auth_service
node_book_api -->|"delegates"| node_book_service
node_loan_api -->|"delegates"| node_loan_service
node_user_api -->|"delegates"| node_user_service
node_category_api -->|"uses"| node_category_repo
node_auth_service -.->|"persists users"| node_mysql
node_book_service -.->|"persists catalog"| node_mysql
node_loan_service -.->|"persists loans"| node_mysql
node_user_service -.->|"persists users"| node_mysql
node_category_repo -.->|"accesses data"| node_mysql
node_cart -.->|"uses local state"| node_context
node_checkout -.->|"uses local state"| node_context

click node_app "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/App.tsx"
click node_catalog "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/CatalogSection.tsx"
click node_book_detail "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/BookDetailModal.tsx"
click node_admin_ui "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/AdminDashboard.tsx"
click node_book_form "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/BookFormModal.tsx"
click node_auth_ui "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/AuthModal.tsx"
click node_cart "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/CartDrawer.tsx"
click node_checkout "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/CheckoutModal.tsx"
click node_context "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/context/LibraryContext.tsx"
click node_api_client "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/lib/api.ts"
click node_mock "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/data/mockData.ts"
click node_api_routes "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/routes/api.php"
click node_auth_api "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/AuthController.php"
click node_book_api "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/BookController.php"
click node_category_api "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/CategoryController.php"
click node_loan_api "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/LoanController.php"
click node_user_api "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/UserController.php"
click node_auth_service "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Services/AuthService.php"
click node_book_service "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Services/BookService.php"
click node_loan_service "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Services/LoanService.php"
click node_user_service "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Services/UserService.php"
click node_category_repo "https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Repositories/Contracts/CategoryRepositoryInterface.php"

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_app,node_catalog,node_book_detail,node_admin_ui,node_book_form,node_auth_ui,node_cart,node_checkout toneBlue
class node_context,node_api_client,node_mock toneAmber
class node_api_routes,node_auth_api,node_book_api,node_category_api,node_loan_api,node_user_api,node_auth_service,node_book_service,node_loan_service,node_user_service toneMint
class node_category_repo,node_mysql toneRose
class node_visitor toneIndigo
```

## Components

### Experiencia web

- [Aplicación](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/App.tsx): `src/App.tsx`
- [Catálogo y destacados](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/CatalogSection.tsx): `src/components/CatalogSection.tsx`
- [Detalle de libro](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/BookDetailModal.tsx): `src/components/BookDetailModal.tsx`
- [Panel administrativo](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/AdminDashboard.tsx): `src/components/AdminDashboard.tsx`
- [Formulario de libro](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/BookFormModal.tsx): `src/components/BookFormModal.tsx`
- [Acceso de usuario](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/AuthModal.tsx): `src/components/AuthModal.tsx`
- [Carrito local](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/CartDrawer.tsx): `src/components/CartDrawer.tsx`
- [Checkout demostrativo](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/components/CheckoutModal.tsx): `src/components/CheckoutModal.tsx`

### Estado e integración

- [Estado de biblioteca](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/context/LibraryContext.tsx): `src/context/LibraryContext.tsx`
- [Cliente API](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Datos iniciales](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/src/data/mockData.ts): `src/data/mockData.ts`

### API y dominio

- [Rutas REST](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [Autenticación API](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/AuthController.php): `backend/app/Http/Controllers/Api/V1/AuthController.php`
- [API de libros](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/BookController.php): `backend/app/Http/Controllers/Api/V1/BookController.php`
- [API de categorías](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/CategoryController.php): `backend/app/Http/Controllers/Api/V1/CategoryController.php`
- [API de préstamos](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/LoanController.php): `backend/app/Http/Controllers/Api/V1/LoanController.php`
- [API de usuarios](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Http/Controllers/Api/V1/UserController.php): `backend/app/Http/Controllers/Api/V1/UserController.php`
- [Servicio de autenticación](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Services/AuthService.php): `backend/app/Services/AuthService.php`
- [Servicio de libros](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Services/BookService.php): `backend/app/Services/BookService.php`
- [Servicio de préstamos](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Services/LoanService.php): `backend/app/Services/LoanService.php`
- [Servicio de usuarios](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Services/UserService.php): `backend/app/Services/UserService.php`

### Persistencia

- [Repositorio categorías](https://github.com/antonny890/libreria-universal-fronted-backend-v3/blob/main/backend/app/Repositories/Contracts/CategoryRepositoryInterface.php): `backend/app/Repositories/Contracts/CategoryRepositoryInterface.php`
- **MySQL**

### Other components

- **Visitante**

## Connections

- Visitante → Aplicación: uses (evidence: `src/App.tsx`)
- Aplicación → Catálogo y destacados: renders (evidence: `src/App.tsx`)
- Aplicación → Panel administrativo: renders (evidence: `src/App.tsx`)
- Aplicación → Detalle de libro: renders (evidence: `src/App.tsx`)
- Aplicación → Formulario de libro: renders (evidence: `src/App.tsx`)
- Aplicación → Acceso de usuario: renders (evidence: `src/App.tsx`)
- Aplicación → Carrito local: renders (evidence: `src/App.tsx`)
- Aplicación → Checkout demostrativo: renders (evidence: `src/App.tsx`)
- Aplicación → Estado de biblioteca: provides state (evidence: `src/App.tsx`)
- Estado de biblioteca → Datos iniciales: loads defaults (evidence: `src/context/LibraryContext.tsx`)
- Estado de biblioteca → Cliente API: calls (evidence: `src/context/LibraryContext.tsx`)
- Visitante → Cliente API: requests (evidence: `README.md`)
- Cliente API → Rutas REST: sends requests (evidence: `README.md`)
- Rutas REST → Autenticación API: routes (evidence: `backend/routes/api.php`)
- Rutas REST → API de libros: routes (evidence: `backend/routes/api.php`)
- Rutas REST → API de categorías: routes (evidence: `backend/routes/api.php`)
- Rutas REST → API de préstamos: routes (evidence: `backend/routes/api.php`)
- Rutas REST → API de usuarios: routes (evidence: `backend/routes/api.php`)
- Autenticación API → Servicio de autenticación: delegates (evidence: `backend/app/Http/Controllers/Api/V1/AuthController.php`)
- API de libros → Servicio de libros: delegates (evidence: `backend/app/Http/Controllers/Api/V1/BookController.php`)
- API de préstamos → Servicio de préstamos: delegates (evidence: `backend/app/Http/Controllers/Api/V1/LoanController.php`)
- API de usuarios → Servicio de usuarios: delegates (evidence: `backend/app/Http/Controllers/Api/V1/UserController.php`)
- API de categorías → Repositorio categorías: uses (evidence: `backend/app/Http/Controllers/Api/V1/CategoryController.php`)
- Servicio de autenticación → MySQL: persists users
- Servicio de libros → MySQL: persists catalog
- Servicio de préstamos → MySQL: persists loans
- Servicio de usuarios → MySQL: persists users
- Repositorio categorías → MySQL: accesses data
- Carrito local → Estado de biblioteca: uses local state
- Checkout demostrativo → Estado de biblioteca: uses local state (evidence: `src/components/CheckoutModal.tsx`)
