How jhonnyyunda86/sistemalatribu works
1. Overall shape
- This is a plain PHP application using a classic MVC structure, not a framework.
- The core runtime is a restaurant management system with three main actor areas: admin, mesero (waiter), and cliente (customer).
2. Entry points and request flow
- The primary web entry is public/index.php, which likely acts as the public front controller.
- There is also a root index.php, which may route or redirect into the public app.
- Requests flow from the browser into controllers in controllers/, which then load models and render views.
3. Presentation layer
- UI is organized in views/.
- Shared chrome lives in views/layouts/ with header.php, footer.php, and sidebar.php.
- Role-specific screens are separated under views/dashboard/, including:
- admin_* views for management,
- cliente_* views for customer self-service,
- mesero_* views for waiter operations.
- Authentication screens live in views/usuarios/ (login.php, registre.php).
4. Controller layer
- Controllers coordinate each business area:
- AuthController.php for login/session handling.
- UsuarioController.php and UsuarioAdminController.php for user management.
- ProductoController.php, MesaController.php, ReservaController.php, PedidoController.php, InventarioController.php, ReporteController.php for domain operations.
- The controllers are the main orchestration boundary between HTTP requests, domain models, and rendered views.
5. Domain and data model
- The app has dedicated model classes in models/ for the core restaurant entities:
- Usuario, UsuarioAdmin
- Producto
- Mesa
- Reserva
- Pedido
- Inventario
- Reporte
- This suggests a relational domain where orders, reservations, tables, products, inventory, and reporting are all persisted through model classes.
6. Persistence and database
- Database configuration is centralized in config/database.php.
- The repository includes SQL assets:
- sql/restaurante.sql as the main schema/data bootstrap,
- additional setup scripts like inventario_setup.sql, menu_cliente_setup.sql, and agregar_activo.sql.
- backup.sql is also present, implying a full database snapshot or migration source.
- The README notes corrected foreign keys and test users, so the DB schema is an important architectural dependency.
7. Authentication and role-based access
- Authentication is built with native PHP password functions: password_hash and password_verify.
- The system explicitly distinguishes roles: admin, mesero, and cliente.
- The README mentions a correction from rol/role, which indicates role consistency is part of the app’s access-control boundary.
8. Role-specific subsystems
- Admin subsystem: dashboards and modules for users, inventory, menu/products, tables, reservations, orders, and reports.
- Cliente subsystem: dashboard, account view, reservation management, and order history/details.
- Mesero subsystem: dashboard, reservation list, order list/details, and stock view.
- These are separated in both controllers and views, which makes role-based navigation and permissions a key architectural concern.
9. Operational/business flows
- The likely business flows are:
- login → role resolution → dashboard selection,
- admin manages catalog/table/order/inventory/report data,
- client browses account/history and makes reservations,
- waiter handles reservations, orders, and stock visibility.
- PedidoController, ReservaController, and MesaController are likely the most workflow-heavy parts because they connect multiple entities.
10. Inventory and reporting
- Inventory is treated as a first-class subsystem with both model and controller support.
- Reporting is separate from transactional views, suggesting summary/analytics queries rather than CRUD only.
- This separation implies that reporting reads across other domain tables instead of owning its own core data.
11. Static and supporting assets
- Product images live under img/productos/, so the catalog likely includes media alongside product records.
- The docs/ folder contains design and analysis artifacts, but these are documentation rather than runtime components.
- The docs are useful for understanding intended module boundaries and use cases, but they are not part of the production request path.
12. Architecture boundary to diagram
- A useful diagram would place the browser/UI on one side, then controllers, then models/database.
- Inside the UI layer, split the dashboards by role.
- Inside the backend, show the main domain modules: authentication, user management, products/menu, tables, reservations, orders, inventory, and reporting.
- The database should be shown as the central persistence layer accessed by all models, with SQL scripts as setup/bootstrap artifacts.
13. What is notably not present
- There is no sign of a framework, API layer, queue worker, or external service integration.
- The architecture appears self-contained: PHP server-side rendering plus MySQL-style relational persistence.
Main entry points: index.php Public entry · dashboard Dashboards · database.php DB config · AuthController.php Auth
Components 25
Entry & UI
Web entry points and rendered screens.
- Root entry · Top-level index.php entry point.
index.php - Public entry · Primary web entry used by the application.
public/index.php - Layouts · Common header, footer, and sidebar chrome.
views/layouts - Auth screens · Login and registration views.
views/usuarios - Dashboards · Role-based admin, cliente, and mesero screens.
views/dashboard
Controllers
HTTP orchestration and role-specific actions.
- Auth · Login, session, and role resolution.
controllers/AuthController.php - Usuarios · Customer account and user management.
controllers/UsuarioController.php - Admin users · Administrative user management.
controllers/UsuarioAdminController.php - Productos · Menu and catalog operations.
controllers/ProductoController.php - Mesas · Table state and table workflow.
controllers/MesaController.php - Reservas · Reservation workflow and scheduling.
controllers/ReservaController.php - Pedidos · Order workflow and order detail handling.
controllers/PedidoController.php - Inventario · Stock and inventory operations.
controllers/InventarioController.php - Reportes · Reporting and summary queries.
controllers/ReporteController.php
Domain Models
Core restaurant entities and business state.
- Usuario · Core user account entity.
models/Usuario.php - UsuarioAdmin · Administrative user entity.
models/UsuarioAdmin.php - Producto · Menu item and product entity.
models/Producto.php - Mesa · Restaurant table entity.
models/Mesa.php - Reserva · Reservation entity.
models/Reserva.php - Pedido · Order entity.
models/Pedido.php - Inventario · Stock and inventory entity.
models/Inventario.php - Reporte · Reporting model and summary data.
models/Reporte.php
Persistence
Database configuration and SQL bootstrap assets.
- DB config · Central database connection settings.
config/database.php - SQL bootstrap · Main schema, backups, and setup scripts.
sql/restaurante.sql - Product images · Catalog image assets used by the UI.
img/productos
Connections 40
- Root entry → Public entry: delegates · Root entry forwards into the public front controller.
- Public entry → Auth: routes · Incoming requests are dispatched to controllers.
- Public entry → Usuarios: routes · Incoming requests are dispatched to controllers.
- Public entry → Admin users: routes · Incoming requests are dispatched to controllers.
- Public entry → Productos: routes · Incoming requests are dispatched to controllers.
- Public entry → Mesas: routes · Incoming requests are dispatched to controllers.
- Public entry → Reservas: routes · Incoming requests are dispatched to controllers.
- Public entry → Pedidos: routes · Incoming requests are dispatched to controllers.
- Public entry → Inventario: routes · Incoming requests are dispatched to controllers.
- Public entry → Reportes: routes · Incoming requests are dispatched to controllers.
- Auth → Auth screens: renders · Authentication screens are rendered here.
- Auth → Layouts: uses · Shared layout chrome wraps auth and dashboard pages.
- Usuarios → Dashboards: renders · Customer account and history pages are rendered here.
- Admin users → Dashboards: renders · Admin management views are rendered here.
- Productos → Dashboards: renders · Menu and product screens are rendered here.
- Mesas → Dashboards: renders · Table management screens are rendered here.
- Reservas → Dashboards: renders · Reservation screens are rendered here.
- Pedidos → Dashboards: renders · Order workflow screens are rendered here.
- Inventario → Dashboards: renders · Inventory screens are rendered here.
- Reportes → Dashboards: renders · Reporting screens are rendered here.
- Auth → Usuario: authenticates · Login and session checks rely on user records.
- Usuarios → Usuario: loads · User account operations use the user model.
- Admin users → UsuarioAdmin: loads · Admin user operations use the admin user model.
- Productos → Producto: loads · Product CRUD and menu data use the product model.
- Mesas → Mesa: loads · Table operations use the table model.
- Reservas → Reserva: loads · Reservation workflow uses the reservation model.
- Pedidos → Pedido: loads · Order workflow uses the order model.
- Inventario → Inventario: loads · Inventory workflow uses the stock model.
- Reportes → Reporte: loads · Reporting uses the report model.
- Usuario → DB config: connects · Models share the centralized database configuration.
- UsuarioAdmin → DB config: connects · Models share the centralized database configuration.
- Producto → DB config: connects · Models share the centralized database configuration.
- Mesa → DB config: connects · Models share the centralized database configuration.
- Reserva → DB config: connects · Models share the centralized database configuration.
- Pedido → DB config: connects · Models share the centralized database configuration.
- Inventario → DB config: connects · Models share the centralized database configuration.
- Reporte → DB config: connects · Models share the centralized database configuration.
- DB config → SQL bootstrap: backed by · Database config points to the SQL schema and setup assets.
- Productos → Product images: uses · Product views likely reference catalog imagery.
- Dashboards → Layouts: composes · Dashboard screens share common layout components.