How carloskapaza/laboratorio-5-6-biblioteca-en-grupo works
1. Overall shape
- This is a classic browser + PHP + database CRUD app, but implemented as a SPA-like experience.
- The browser loads one shell page, and JavaScript swaps in server-rendered fragments instead of doing full page reloads.
2. Frontend shell
- The main entry point is the page shell (index.html in the tree; the README refers to it as index.php).
- It contains the sidebar navigation, the main content container, and a separate modal container used for forms.
3. Client-side controller
- app.js is the central orchestrator.
- It handles menu clicks, fetches HTML fragments for views, fetches JSON for record data, updates the DOM, and opens/closes Bootstrap modals.
4. Dynamic content boundary
- The main content area is a placeholder for server-generated HTML.
- libros/lista.php and usuarios/lista.php are meant to return table markup that gets injected into this area.
- This keeps navigation asynchronous while still letting PHP render the table structure.
5. Modal/form boundary
- libros/registro.php and usuarios/registro.php act as form templates.
- They are fetched on demand and injected into the modal container, so the same form can be reused for create and edit flows.
6. Libro CRUD backend
- The libros/ folder is split into:
- HTML-producing scripts: lista.php, registro.php
- JSON endpoints: create.php, get.php, update.php, delete.php
- This separation is important: views return HTML, while operations return JSON status/data.
7. Libro data flow
- List: app.js fetches libros/lista.php and injects the returned table into the main container.
- Create: app.js loads registro.php, submits form data to create.php, then reloads the list.
- Edit: app.js loads the form, requests a single record from get.php?id=..., fills the inputs, then submits to update.php.
- Delete: app.js confirms with the user, posts the id to delete.php, then refreshes the list.
8. Shared database access
- conexion.php is the shared server-side connection module.
- All PHP scripts that touch the database depend on it, so the DB connection is centralized rather than duplicated.
9. Usuarios subsystem
- The usuarios/ directory mirrors the same CRUD-oriented structure as libros/, but the tree shows fewer files.
- It likely reuses the same architectural pattern: list view, form template, and server-side create/list operations.
10. Styling and UI dependencies
- estilos.css is the app’s custom visual layer on top of Bootstrap.
- Bootstrap provides layout, modal behavior, and responsive structure; the custom CSS defines the project’s identity and overrides defaults.
- The README also indicates Google Fonts are part of the presentation stack.
11. External-facing technologies
- The implementation relies on vanilla JavaScript with fetch(), PHP endpoints, Bootstrap, and a relational database accessed through server-side PHP.
- The key architectural constraint is that the frontend never talks to the database directly; all data access goes through PHP.
12. Diagram boundaries to show
- Browser UI shell
- JavaScript controller layer
- PHP HTML fragment endpoints
- PHP JSON CRUD endpoints
- Shared DB connection module
- Database persistence layer
Main entry points: app.js App logic · conexion.php DB connect · estilos.css Theme CSS · index.html Shell page
Components 16
Client UI
Browser shell, controller, and presentation layer
- Shell page · Single-page shell with navigation, content, and modal containers
index.html - App logic · Orchestrates navigation, fragment loading, form flows, and CRUD requests
app.js - Theme CSS · Custom visual layer over Bootstrap
estilos.css - Bootstrap · External UI framework for layout and modals
- Google Fonts · External typography dependency referenced by the app
Libros
Book CRUD views and endpoints
- Libro list · Server-rendered table view for books
libros/lista.php - Libro form · Reusable create/edit form template for books
libros/registro.php - Libro create · Creates a book record and returns status/data
libros/create.php - Libro fetch · Returns one book record for editing
libros/get.php - Libro update · Updates an existing book record
libros/update.php - Libro delete · Deletes a book record
libros/delete.php
Usuarios
User CRUD views and endpoints
- Usuario list · Server-rendered table view for users
usuarios/lista.php - Usuario form · Reusable create/edit form template for users
usuarios/registro.php - Usuario create · Creates a user record
usuarios/create.php
Server Core
Shared PHP infrastructure and persistence boundary
- DB connect · Shared connection module used by server scripts
conexion.php - Database · Persistent data store behind the PHP endpoints
Connections 24
- App logic → Shell page: drives UI · Updates the shell content and modal areas
- Shell page → App logic: loads · Page shell bootstraps the client controller
- App logic → Bootstrap: uses · Relies on Bootstrap for modal and layout behavior
- Theme CSS → Bootstrap: overrides · Custom CSS layers on top of Bootstrap defaults
- Theme CSS → Google Fonts: uses · Presentation layer depends on external fonts
- App logic → Libro list: fetches HTML · Loads the books table into the main content area
- App logic → Libro form: fetches form · Loads the reusable book form into the modal container
- App logic → Libro create: submits · Sends create requests for books
- App logic → Libro fetch: prefills · Requests one book record before edit
- App logic → Libro update: submits · Sends update requests for books
- App logic → Libro delete: submits · Sends delete requests for books
- App logic → Usuario list: fetches HTML · Loads the users table into the main content area
- App logic → Usuario form: fetches form · Loads the reusable user form into the modal container
- App logic → Usuario create: submits · Sends create requests for users
- Libro list → DB connect: queries · Uses the shared DB connection for data access
- Libro form → DB connect: queries · Uses the shared DB connection when needed for form data
- Libro create → DB connect: writes · Persists new book records through the shared connection
- Libro fetch → DB connect: reads · Fetches a single book record through the shared connection
- Libro update → DB connect: writes · Updates book records through the shared connection
- Libro delete → DB connect: writes · Deletes book records through the shared connection
- Usuario list → DB connect: queries · Uses the shared DB connection for user listings
- Usuario form → DB connect: queries · Uses the shared DB connection when needed for form data
- Usuario create → DB connect: writes · Persists new user records through the shared connection
- DB connect → Database: connects to · Centralized PHP bridge to the relational database