How alexdevcoding/sistema-wander works
Project type and purpose
• This is a monolithic, server-rendered PHP web application for library employee management—handling authentication, employee CRUD, payroll calculations, reports, and database backups.
• It leverages TailwindCSS and Flowbite on the frontend, PHP controllers/views on the backend, and a relational database (presumably MySQL) for persistence.
File structure
• src/Backend – PHP “controllers” and route handlers (e.g., login.php, añadir-empleado.php, tablas/actions/*).
• src/templates – server-side view templates (Admin vs. Empleado roles, plus shared pages like login.php, 404.php).
• src/assets – static assets (CSS inputs/outputs, compiled Tailwind styles, Flowbite JS, custom JS modules, images, webfonts).
• Top-level scripts – actualizar_db.php for automated DB updates/backups; tailwind.config.js for CSS build; package.json for dependency management.
• Credentials and backup SQL files under src/Backend/respaldo.
README
• Installation steps focus solely on setting up Tailwind and Flowbite.
Main components
a. Client Tier (Browser)
– HTML/CSS/JS assets: TailwindCSS styles, Flowbite components, custom JS for UI interactions (añadir-empleado.js, graficas.js, buscador.js, etc.).
b. Web/Application Tier
– Web Server (e.g., Apache or Nginx + PHP-FPM) hosting:
• Entry points & route resolvers in src/Backend (login, logout, auth, registrar, añadir-empleado, graficas, reports, tablas/actions, etc.)
• View layer in src/templates (distinguish Admin vs. Empleado layouts and pages).
• Shared PHP modules: conexión.php for DB connection handling, autenticación.php for session/auth logic.
• Scheduled scripts: actualizar_db.php for backups.
c. Data Tier
– Relational Database (MySQL or MariaDB)
– Backup storage (SQL dumps in src/Backend/respaldo)
d. External services (optional/placeholder)
– CDN for serving static assets (if used in production)
– Cron scheduler (Linux cron) triggering actualizar_db.php
Relationships & data flows
• The Browser initiates HTTP(S) requests (GET/POST) to the Web Server.
• The Web Server dispatches to PHP controllers in src/Backend. Controllers interact with conexión.php to run SQL queries, call tablas/actions for CRUD or calculo-nomina, then render templates from src/templates populated with dynamic data.
• Response (HTML) plus linked JS/CSS is returned to the browser.
• Database backups are executed on a schedule or manually via actualizar_db.php; resulting SQL files are saved under /respaldo.
• User roles (Admin vs. Empleado) drive which templates/controllers are accessible after authentication.
Architectural patterns & design principles
• Layered architecture: Presentation (templates + assets) → Application (controllers + services) → Data (DB + backups).
• Separation of concerns:
– src/assets/js handles purely client-side logic
– src/templates holds view markup
– src/Backend houses request handling & business logic
– conexión.php centralizes DB connectivity
• MVC-inspired flow (though not strict MVC framework): Controllers → Models (raw SQL in acciones) → Views (PHP templates).