# Application structure

Canonical root: `C:/Users/Hp/Herd/cafe-erp`.

| Directory | Responsibility |
| --- | --- |
| app/Config | Explicit routes and allowlisted management definitions |
| app/Controllers/Auth, Setup | Login and local first-manager setup |
| app/Controllers/Admin | CRUD, purchasing, stock workflows, reports, table codes and photos |
| app/Controllers/Pos | Bills, payments, fulfillment, losses and QR review |
| app/Controllers/Customer | Public menu, scoped order status and safe photos |
| app/Services | Named rules, validation, transactions and audits |
| app/Models | Bound SQL persistence and report queries |
| app/Support | Exact money/quantities, dates, savepoints and advisory locks |
| app/Filters | Fresh active-account/action-permission checks |
| app/Database/Schema, Migrations, Seeds | Foundation SQL, additive migrations and structural seed |
| app/Views/layouts, components | Shared Bootstrap presentation |
| app/Views/auth, management, sales, purchasing, inventory, tables, reports | Working staff pages |
| app/Views/customer | Working customer pages alongside isolated legacy previews |
| public/assets | Local Bootstrap, CSS and separate scripts |
| writable/uploads/menu | Sanitized private photo storage |
| docs | Copied original references and current notes |
| tests/integration | Portable SQL and isolated MySQL workflows |
| tests/working-browser | Working application scenarios |
| tests/browser | Read-only preview checks |
| tests/mysql | Guarded database preparation, migration, cleanup and schema checks |

Use PascalCase classes, camelCase methods and snake_case database fields. Controllers derive actors from sessions; models receive validated service values. Immutable history is separate from editable master data.
