# leonard0nt/prestamos_local architecture

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

- Interactive diagram: https://gitdiagram.com/leonard0nt/prestamos_local
- Repository: https://github.com/leonard0nt/prestamos_local

## Overview

Préstamos Biblioteca CSF is a Django/DRF school-library management system with web and REST interfaces, plus an optional Windows desktop launcher. A library operator signs in, then manages level-scoped users, books and physical copies; loan operations validate availability and user status, track due dates, and record returns or archive history. The domain is split across user, catalog/copy, and loan stages, backed by PostgreSQL. The README documents the major workflows and desktop mode; some subsystem links below rely on those documented capabilities because not every implementation file was sampled.

Main entry points: [`prestamos_biblioteca/urls.py`](https://github.com/leonard0nt/prestamos_local/blob/master/prestamos_biblioteca/urls.py) (URL and API router), [`librosApp/models.py`](https://github.com/leonard0nt/prestamos_local/blob/master/librosApp/models.py) (Books and copies), [`librosApp/views.py`](https://github.com/leonard0nt/prestamos_local/blob/master/librosApp/views.py) (Books and copies), [`prestamoApp/views.py`](https://github.com/leonard0nt/prestamos_local/blob/master/prestamoApp/views.py) (Loan operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and routing"]
  node_desktop["Desktop launcher<br/>[desktop_app.py]"]
  node_routes["URL and API router<br/>[urls.py]"]
  node_webui["Web interface"]
end

subgraph group_people["Users and access"]
  node_auth_views["Login and accounts<br/>[views.py]"]
  node_user_api["User management<br/>[views.py]"]
  node_user_serializers["User serialization<br/>[serializers.py]"]
end

subgraph group_catalog["Catalog management"]
  node_catalog_views["Books and copies<br/>[views.py]"]
  node_catalog_serializers["Catalog serialization<br/>[serializers.py]"]
end

subgraph group_circulation["Loans and returns"]
  node_loan_views["Loan operations<br/>[views.py]"]
  node_loan_serializers["Loan validation<br/>[serializers.py]"]
end

subgraph group_persistence["Domain records"]
  node_user_records[("Users and staff<br/>[models.py]")]
  node_catalog_records[("Books and copies<br/>[models.py]")]
  node_loan_records[("Loan history<br/>[models.py]")]
end

node_operator(("Library operator"))
node_api_client(("REST API client"))
node_postgres[("PostgreSQL")]

node_operator -->|"uses"| node_routes
node_operator -.->|"opens"| node_desktop
node_desktop -->|"serves app"| node_routes
node_api_client -->|"calls API"| node_routes
node_routes -->|"routes auth"| node_auth_views
node_routes -->|"routes users"| node_user_api
node_routes -->|"routes catalog"| node_catalog_views
node_routes -->|"routes loans"| node_loan_views
node_routes -.->|"renders pages"| node_webui
node_user_api -->|"serializes users"| node_user_serializers
node_user_api -->|"reads and writes"| node_user_records
node_user_serializers -->|"maps records"| node_user_records
node_auth_views -->|"authenticates"| node_user_records
node_catalog_views -->|"serializes catalog"| node_catalog_serializers
node_catalog_views -->|"reads and writes"| node_catalog_records
node_catalog_views -->|"checks active loans"| node_loan_records
node_catalog_serializers -->|"maps records"| node_catalog_records
node_loan_views -->|"serializes loans"| node_loan_serializers
node_loan_views -->|"reads and updates"| node_loan_records
node_loan_views -->|"updates copy state"| node_catalog_records
node_loan_serializers -->|"validates and creates"| node_loan_records
node_loan_serializers -->|"checks availability"| node_catalog_records
node_user_records -.->|"persists"| node_postgres
node_catalog_records -.->|"persists"| node_postgres
node_loan_records -.->|"persists"| node_postgres

click node_desktop "https://github.com/leonard0nt/prestamos_local/blob/master/desktop_app.py"
click node_routes "https://github.com/leonard0nt/prestamos_local/blob/master/prestamos_biblioteca/urls.py"
click node_webui "https://github.com/leonard0nt/prestamos_local/tree/master/templates"
click node_auth_views "https://github.com/leonard0nt/prestamos_local/blob/master/usuarioApp/views.py"
click node_user_api "https://github.com/leonard0nt/prestamos_local/blob/master/usuarioApp/views.py"
click node_user_serializers "https://github.com/leonard0nt/prestamos_local/blob/master/usuarioApp/serializers.py"
click node_user_records "https://github.com/leonard0nt/prestamos_local/blob/master/usuarioApp/models.py"
click node_catalog_views "https://github.com/leonard0nt/prestamos_local/blob/master/librosApp/views.py"
click node_catalog_serializers "https://github.com/leonard0nt/prestamos_local/blob/master/librosApp/serializers.py"
click node_catalog_records "https://github.com/leonard0nt/prestamos_local/blob/master/librosApp/models.py"
click node_loan_views "https://github.com/leonard0nt/prestamos_local/blob/master/prestamoApp/views.py"
click node_loan_serializers "https://github.com/leonard0nt/prestamos_local/blob/master/prestamoApp/serializers.py"
click node_loan_records "https://github.com/leonard0nt/prestamos_local/blob/master/prestamoApp/models.py"

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_desktop,node_routes,node_webui,node_api_client toneBlue
class node_auth_views,node_user_api,node_user_serializers,node_postgres toneAmber
class node_catalog_views,node_catalog_serializers toneMint
class node_loan_views,node_loan_serializers toneRose
class node_user_records,node_catalog_records,node_loan_records,node_operator toneIndigo
```

## Components

### Entry and routing

- [Desktop launcher](https://github.com/leonard0nt/prestamos_local/blob/master/desktop_app.py): `desktop_app.py`
- [URL and API router](https://github.com/leonard0nt/prestamos_local/blob/master/prestamos_biblioteca/urls.py): `prestamos_biblioteca/urls.py`
- [Web interface](https://github.com/leonard0nt/prestamos_local/tree/master/templates): `templates`

### Users and access

- [Login and accounts](https://github.com/leonard0nt/prestamos_local/blob/master/usuarioApp/views.py): `usuarioApp/views.py`
- [User management](https://github.com/leonard0nt/prestamos_local/blob/master/usuarioApp/views.py): `usuarioApp/views.py`
- [User serialization](https://github.com/leonard0nt/prestamos_local/blob/master/usuarioApp/serializers.py): `usuarioApp/serializers.py`

### Catalog management

- [Books and copies](https://github.com/leonard0nt/prestamos_local/blob/master/librosApp/views.py): `librosApp/views.py`
- [Catalog serialization](https://github.com/leonard0nt/prestamos_local/blob/master/librosApp/serializers.py): `librosApp/serializers.py`

### Loans and returns

- [Loan operations](https://github.com/leonard0nt/prestamos_local/blob/master/prestamoApp/views.py): `prestamoApp/views.py`
- [Loan validation](https://github.com/leonard0nt/prestamos_local/blob/master/prestamoApp/serializers.py): `prestamoApp/serializers.py`

### Domain records

- [Users and staff](https://github.com/leonard0nt/prestamos_local/blob/master/usuarioApp/models.py): `usuarioApp/models.py`
- [Books and copies](https://github.com/leonard0nt/prestamos_local/blob/master/librosApp/models.py): `librosApp/models.py`
- [Loan history](https://github.com/leonard0nt/prestamos_local/blob/master/prestamoApp/models.py): `prestamoApp/models.py`

### Other components

- **Library operator**
- **REST API client**
- **PostgreSQL**

## Connections

- Library operator → URL and API router: uses (evidence: `README.md`)
- Library operator → Desktop launcher: opens (evidence: `README.md`)
- Desktop launcher → URL and API router: serves app (evidence: `README.md`)
- REST API client → URL and API router: calls API (evidence: `README.md`)
- URL and API router → Login and accounts: routes auth (evidence: `prestamos_biblioteca/urls.py`)
- URL and API router → User management: routes users (evidence: `prestamos_biblioteca/urls.py`)
- URL and API router → Books and copies: routes catalog (evidence: `prestamos_biblioteca/urls.py`)
- URL and API router → Loan operations: routes loans (evidence: `prestamos_biblioteca/urls.py`)
- URL and API router → Web interface: renders pages (evidence: `README.md`)
- User management → User serialization: serializes users (evidence: `usuarioApp/views.py`)
- User management → Users and staff: reads and writes (evidence: `usuarioApp/views.py`)
- User serialization → Users and staff: maps records (evidence: `usuarioApp/serializers.py`)
- Login and accounts → Users and staff: authenticates (evidence: `usuarioApp/views.py`)
- Books and copies → Catalog serialization: serializes catalog (evidence: `librosApp/views.py`)
- Books and copies → Books and copies: reads and writes (evidence: `librosApp/views.py`)
- Books and copies → Loan history: checks active loans (evidence: `librosApp/views.py`)
- Catalog serialization → Books and copies: maps records (evidence: `librosApp/serializers.py`)
- Loan operations → Loan validation: serializes loans (evidence: `prestamoApp/views.py`)
- Loan operations → Loan history: reads and updates (evidence: `prestamoApp/views.py`)
- Loan operations → Books and copies: updates copy state (evidence: `prestamoApp/views.py`)
- Loan validation → Loan history: validates and creates (evidence: `prestamoApp/serializers.py`)
- Loan validation → Books and copies: checks availability (evidence: `prestamoApp/serializers.py`)
- Users and staff → PostgreSQL: persists (evidence: `README.md`)
- Books and copies → PostgreSQL: persists (evidence: `README.md`)
- Loan history → PostgreSQL: persists (evidence: `README.md`)
