How jxnci/bibliotecaapp works
Main Components
• Backend API:
• Built on Laravel 11; follows an MVC pattern.
• Key directories include:
▪ Controllers (in api/app/Http/Controllers): For handling authentication, resource management (e.g., Autores, Categorias, Libros, Prestamos, etc.).
▪ Models (in api/app/Models): Representing the data entities (Autor, Libro, Prestamo, etc.) with Eloquent ORM.
▪ Routes (in api/routes): Defines endpoints for the API (api.php, web.php, etc.).
▪ Migrations & Seeders (in api/database/migrations & seeders): For database schema definition and data initialization.
▪ Configuration and middleware (in api/config): For authentication (auth.php), caching, logging, and more.
• Essential aspects: API endpoints to enable CRUD operations for authors, books, loans (préstamos), fines (multas), and user management, as well as authentication and authorization.
• Frontend Application:
• Built on Vue 3 using Vite as a build tool with Tailwind CSS for styling.
• Key directories include:
▪ src: Contains components (Vue components like BarChart, HelloWorld, etc.), views (Dashboard, Login, Reportes, etc.), composables (for reusable logic), routers (for navigation), stores (for state management), and services (for API interactions).
▪ public & index.html: Primary entry points for the web application.
• Essential aspects: UI components that interact with the backend API, routing for different views (login, dashboard, reporting), and integration of statistical dashboards.
• Database:
• MySQL database is required as stated in the README.
• The Laravel migrations and seeders indicate that the database includes tables for users, authors, books, loans, categories, fines, and related details (detalle_autores, detalle_prestamos).
• External/Supporting Components:
• Authentication Service: Managed by Laravel (sanctum configuration and AuthController).
• Frontend API Services: JavaScript services (in app/src/services) that encapsulate the API calls.
• Setup Script: A batch file ("setup.bat") is available to initialize or configure the project.
Relationships and Interactions
• The frontend communicates with the backend through RESTful API endpoints.
• The backend controllers handle incoming API calls, manipulate models, and interact with the database (via migrations and seeders).
• The frontend services act as clients that abstract API endpoints for managing resources (autores, libros, prestamos, etc.) as well as handling authentication.
• The authentication component in Laravel ensures the correct roles and permissions when a user logs in via the frontend.
Architectural Patterns and Design Principles
• MVC Pattern in the Backend: Controllers, Models, and Views (though mostly API views using Blade or JSON responses).
• Component-based Architecture in the Frontend: Vue components for UI, composables for reusability, and centralized state management via stores.
• Separation of Concerns: Clear separation between API endpoints (backend) and client-side presentation and logic (frontend).
• RESTful API design: Well-structured routing and controllers enabling CRUD operations.
• Dependency management is handled using Composer (for Laravel) and npm/yarn (for Vue and JavaScript packages).