How bichotas-season/bibliosoftb works
Project Type and Purpose
• This is a standalone Spring Boot microservice (“Módulo Préstamos”) that exposes a REST API for managing library book loans: registering loans, tracking statuses, calculating fines for overdue returns, and handling returns.
• It uses JWT for security, Swagger/OpenAPI for documentation, and MongoDB (via Spring Data) for persistence.
High-Level Components
a. Clients
• Front-end SPA or any HTTP client (e.g. Postman)
• Other backend services (e.g. Student or Book modules) via the ApiClient
b. API Layer
• CorsConfig – enforces allowed origins (FRONTEND_URL)
• SecurityConfig + JwtAuthenticationFilter – configures Spring Security filter chain for JWT auth
• SwaggerConfig – exposes /swagger-ui for API docs
c. Controller Layer
• PrestamoController – maps HTTP endpoints (/prestamos, /prestamos-prestados, etc.) to service methods
d. Service Layer
• PrestamoService – core business logic (create, update, delete, calculate fines)
• TaskScheduledService – scheduled jobs (e.g. periodic overdue check/fine update)
• ApiClient – outbound REST client to student/book validation services
e. Repository Layer
• PrestamoRepository – Spring Data MongoDB interface for CRUD operations on Prestamo documents
f. Data Model
• Prestamo entity (loan document)
• DTOs: DevolucionDTO (return payload), PrestamoVencidoDTO (overdue notices)
g. Persistence
• MongoDB database (configured via SPRING_DATA_MONGODB_URI)
h. Infrastructure & Config
• application.properties / application-dev/prod.properties – environment-specific settings
• Docker (optional) – containerization
Relationships and Data Flows
• Clients → HTTP(S) → CorsConfig → JwtAuthenticationFilter → PrestamoController
• PrestamoController → PrestamoService → PrestamoRepository → MongoDB
• PrestamoService ↔ ApiClient → External Student/Book modules (validate availability, student eligibility)
• TaskScheduledService (cron) → PrestamoService → PrestamoRepository → MongoDB (update overdue fines)
• SwaggerConfig exposes metadata → clients
Architectural Patterns & Design Principles
• Layered architecture (Controller → Service → Repository)
• Filter chain for cross-cutting concerns (CORS, Security)
• DTOs for inbound/outbound data segregation
• Scheduled tasks for asynchronous/periodic processing
• External API client abstraction for decoupling from other modules
9. At the bottom or side, note configuration sources (application-*.properties, environment variables).