How darwin-1bit/bingomaster works
1. Overall shape
- This is a custom PHP/MySQL application built around a classic MVC-style structure: controllers/, models/, and views/.
- The main domain is bingo sales operations: cartones, ventas, entregas, comisiones, metas, notificaciones, and user/vendor administration.
2. Entry point and request flow
- public/index.php is the public entrypoint and likely acts as the front controller.
- Requests enter through public/, are routed into controller classes in controllers/, which then coordinate model access and select a view for rendering.
3. Presentation layer
- The UI is split into reusable layouts under views/layouts/ and feature pages under views/.
- Feature views are organized by workflow: authentication, dashboards, ventas, cartones, entregas, metas, notificaciones, usuarios, and vendedores.
4. Domain/application layer
- Controllers represent the main business workflows:
- AuthController, RecuperarController for login and password recovery
- VentaController, VentaVendedorController for sales flows
- CartonController for bingo card management
- EntregaController for delivery/fulfillment
- MetaController and ComisionController for goals and commissions
- NotificacionController and NotificacionVendedorController for messaging/alerts
- UsuarioController, AdminUsuarioController, VendedorController for administration and role-specific management
- The controller split suggests separate admin and vendedor experiences.
5. Data layer
- Models under models/ encapsulate persistence for core entities: usuarios, ventas, cartones, entregas, metas, and notificaciones.
- This layer is the primary boundary to MySQL and likely contains the SQL queries and record shaping used by controllers.
6. Database and schema
- Database configuration lives in config/database.php.
- The schema and seed data appear to be defined in sql/bingomaster.sql.
- The application is designed to depend on a MySQL backend and is not structured around an ORM; the repo suggests hand-managed relational tables.
7. Email and notifications
- config/mail.php indicates outbound email is a first-class integration, likely for password recovery and user notifications.
- Notifications are also modeled in the app itself, so there is both application-level notification storage and external email delivery.
8. Role-based areas
- The views and controllers are divided around two major user roles: admin and vendedor.
- Separate dashboards exist in views/dashboard/admin.php and views/dashboard/vendedor.php, which indicates role-specific navigation, KPIs, and available actions.
9. Core business processes
- Sales are central: ventas, mis_ventas, and registrar_venta show a transaction flow from capture to reporting.
- Supporting processes include cartón management, delivery tracking, commission calculation, goal tracking, and payout/earnings views like mi_ganancias.
10. Static assets and runtime packaging
- Static CSS is served from public/css/, organized by concern such as buttons, navbar, responsive behavior, roles, and stats.
- vendor/ plus composer.json indicate Composer-managed dependencies, but the app itself is mostly custom PHP rather than a large framework.
11. Documentation and design artifacts
- The docs/ folder is unusually rich and maps one-to-one to controllers, models, views, config, and SQL.
- There are also use-case diagrams for admin and vendedor flows, which reinforces the role-based architecture.
12. Architecture boundaries to diagram
- A useful diagram should show:
- Browser/users entering through public/index.php
- Controllers orchestrating business use cases
- Models reading/writing MySQL
- Config supplying DB and mail settings
- Views rendering admin/vendor dashboards and feature pages
- External mail service used for recovery/notifications
- The strongest structural boundary is between presentation/workflow logic in controllers and persistence logic in models, with role-specific UX branching after authentication.
Main entry points: index.php Front controller · database.php Database config · usuario.php User model · cartones Ops UI
Components 30
Presentation
Front controller, shared layout, and feature views.
- Front controller · Public web entry and request bootstrap.
public/index.php - Layouts · Shared header, footer, and sidebar shell.
views/layouts - Auth pages · Login, registration, and password recovery screens.
views/usuarios - Admin dashboard · Role-specific admin landing page.
views/dashboard/admin.php - Vendor dashboard · Role-specific vendedor landing page.
views/dashboard/vendedor.php - Sales UI · Venta, mis ventas, and registrar venta screens.
views/ventas - Ops UI · Cartones, entregas, metas, notificaciones, usuarios, and vendedores screens.
views/cartones
Application
Controllers that coordinate business workflows.
- Auth controller · Login and session access flow.
controllers/AuthController.php - Recovery controller · Password recovery and email-assisted reset flow.
controllers/RecuperarController.php - Sales controller · Main sales capture and reporting workflow.
controllers/VentaController.php - Vendor sales · Vendor-facing sales workflow and self-service views.
controllers/VentaVendedorController.php - Cartons · Bingo card administration.
controllers/CartonController.php - Deliveries · Delivery and fulfillment operations.
controllers/EntregaController.php - Goals · Sales goals and targets.
controllers/MetaController.php - Commissions · Commission calculation and payout logic.
controllers/ComisionController.php - Notifications · Application alerts and inbox workflows.
controllers/NotificacionController.php - Vendor alerts · Vendor-specific notifications and messaging.
controllers/NotificacionVendedorController.php - Users · User administration and profile management.
controllers/UsuarioController.php - Admin users · Admin-side user and role management.
controllers/AdminUsuarioController.php - Vendors · Vendor administration and management.
controllers/VendedorController.php
Data
Persistence models and SQL schema.
- Sales model · Persistence for sales and related records.
models/VentaModel.php - Carton model · Persistence for bingo card entities.
models/CartonModel.php - Delivery model · Persistence for deliveries and fulfillment.
models/EntregaModel.php - Goals model · Persistence for targets and progress.
models/MetaModel.php - Notification model · Storage for app-level notifications.
models/NotificacionModel.php - User model · Persistence for users and roles.
models/usuario.php
Integrations
Runtime configuration and external services.
- Database config · MySQL connection settings.
config/database.php - Mail config · Outbound email settings.
config/mail.php - MySQL · Relational backend schema and data store.
sql/bingomaster.sql - Email service · Outbound delivery for recovery and notifications.
Connections 46
- Front controller → Auth controller: routes to · Front controller dispatches requests into application controllers.
- Front controller → Sales controller: routes to · Front controller dispatches requests into application controllers.
- Front controller → Vendor sales: routes to · Front controller dispatches requests into application controllers.
- Front controller → Cartons: routes to · Front controller dispatches requests into application controllers.
- Front controller → Deliveries: routes to · Front controller dispatches requests into application controllers.
- Front controller → Goals: routes to · Front controller dispatches requests into application controllers.
- Front controller → Notifications: routes to · Front controller dispatches requests into application controllers.
- Auth controller → Auth pages: renders · Authentication workflows select login and registration views.
- Recovery controller → Auth pages: renders · Recovery flow uses the auth pages.
- Sales controller → Sales UI: renders · Sales controller selects sales-related views.
- Vendor sales → Sales UI: renders · Vendor sales controller selects self-service sales views.
- Cartons → Ops UI: renders · Operations screens include card management pages.
- Deliveries → Ops UI: renders · Operations screens include delivery pages.
- Goals → Ops UI: renders · Operations screens include goal pages.
- Notifications → Ops UI: renders · Operations screens include notification pages.
- Users → Ops UI: renders · User administration pages live in the operations area.
- Admin users → Admin dashboard: renders · Admin management connects to the admin dashboard.
- Vendors → Vendor dashboard: renders · Vendor management connects to the vendor dashboard.
- Auth controller → User model: uses · Authentication reads and validates user records.
- Recovery controller → User model: uses · Password recovery targets user records.
- Sales controller → Sales model: uses · Sales workflows persist and query sales data.
- Vendor sales → Sales model: uses · Vendor sales workflows persist and query sales data.
- Cartons → Carton model: uses · Card management reads and writes card data.
- Deliveries → Delivery model: uses · Delivery workflows read and write fulfillment data.
- Goals → Goals model: uses · Goal workflows read and write target data.
- Notifications → Notification model: uses · Notification workflows persist app alerts.
- Vendor alerts → Notification model: uses · Vendor alerts reuse notification storage.
- Users → User model: uses · User management reads and writes user records.
- Admin users → User model: uses · Admin user management reads and writes user records.
- Vendors → User model: uses · Vendor management reads and writes user records.
- Sales model → Database config: connects via · Models depend on the database connection config.
- Carton model → Database config: connects via · Models depend on the database connection config.
- Delivery model → Database config: connects via · Models depend on the database connection config.
- Goals model → Database config: connects via · Models depend on the database connection config.
- Notification model → Database config: connects via · Models depend on the database connection config.
- User model → Database config: connects via · Models depend on the database connection config.
- Database config → MySQL: targets · Database config points the app at the MySQL backend.
- Mail config → Email service: targets · Mail configuration drives outbound email delivery.
- Auth controller → Mail config: uses · Auth flows may send recovery or account emails.
- Recovery controller → Mail config: uses · Recovery flow relies on email delivery settings.
- Notifications → Mail config: uses · Notifications can be sent through email integration.
- Vendor alerts → Mail config: uses · Vendor alerts can be sent through email integration.
- Layouts → Admin dashboard: wraps · Shared layout frames role-specific screens.
- Layouts → Vendor dashboard: wraps · Shared layout frames role-specific screens.
- Layouts → Sales UI: wraps · Shared layout frames feature pages.
- Layouts → Ops UI: wraps · Shared layout frames feature pages.