Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JAQA20/LaComanda/llms.txt

Use this file to discover all available pages before exploring further.

La Comanda persists all restaurant data — users, tables, orders, and products — in a MySQL 8 database whose full schema is defined in db/la_comanda.sql. When Docker Compose starts for the first time, the official MySQL image automatically imports that file, creates the schema, seeds reference data, and applies the utf8mb4 character set throughout. No manual migration step is required.
The schema uses the utf8mb4 charset and utf8mb4_unicode_ci collation on every table, providing full Unicode support including emoji and accented characters common in Spanish-language menus.

Schema Overview

The database is composed of ten tables and one view. The diagram below lists each object and its purpose.

roles

Defines the four access levels recognised by the application.
ColumnTypeNotes
idINT PKAuto-increment surrogate key
nombreVARCHAR(50)admin, mesero, cocina, barista

usuarios

Stores every staff account that can log in to La Comanda.
ColumnTypeNotes
idINT PKAuto-increment surrogate key
nombreVARCHAR(100)First name
apellidoVARCHAR(100)Last name
emailVARCHAR(150)Unique login identifier
activoTINYINT(1)1 = active, 0 = deactivated
passwordVARCHAR(255)bcrypt hash — never stored in plain text
rol_idINT FKReferences roles.id
creado_enDATETIMEAccount creation timestamp

password_resets

Tracks one-time tokens used by the forgot-password flow.
ColumnTypeNotes
idINT PKAuto-increment surrogate key
usuario_idINT FKReferences usuarios.id
tokenVARCHAR(64)SHA-256 hash of the raw token sent via email
expira_enDATETIMEToken expires 60 minutes after creation
usadoTINYINT(1)1 once the token has been redeemed

mesas

Represents the physical dining tables in the restaurant.
ColumnTypeNotes
idINT PKAuto-increment surrogate key
numeroINTHuman-readable table number shown in the UI
estadoENUMdisponible (free) or ocupada (occupied)
Twelve tables are seeded by default (numbers 1–12).

layout_configs

Persists the drag-and-drop floor-plan layout configured by the administrator.
ColumnTypeNotes
idINT PKAuto-increment surrogate key
layout_keyVARCHAR(100)Identifies the layout context (e.g. default)
payload_jsonLONGTEXTFull JSON snapshot of table positions
actualizado_porINT FKusuarios.id of the last editor
created_atTIMESTAMPRow creation time
updated_atTIMESTAMPLast modification time

categorias

Groups products and drives automatic kitchen/barista routing.
ColumnTypeNotes
idINT PKAuto-increment surrogate key
nombreVARCHAR(100)Display name shown in the POS UI
slugVARCHAR(100)URL-safe identifier — controls preparation routing
iconoVARCHAR(100)FontAwesome class name (e.g. fa-coffee)
ordenINTSort order in category lists
activoTINYINT(1)1 = visible, 0 = hidden

productos

The menu items that waitstaff can add to an order.
ColumnTypeNotes
idINT PKAuto-increment surrogate key
categoria_idINT FKReferences categorias.id
nombreVARCHAR(150)Product display name
precioDECIMAL(10, 2)Unit price in local currency
iconoVARCHAR(100)FontAwesome class name
activoTINYINT(1)1 = available for ordering

ordenes

One row per open or completed order, linked to a table and the waiter who created it.
ColumnTypeNotes
id_ordenINT PKAuto-increment surrogate key
numero_ordenINTSequential display number for the shift
mesa_idINT FKReferences mesas.id
id_usuarioINT FKWaiter who opened the order
notasTEXTOptional free-text notes for the kitchen
totalDECIMAL(10, 2)Calculated order total
fecha_creacionDATETIMEWhen the order was placed
fecha_listaDATETIMEWhen all items were marked ready
fecha_entregaDATETIMEWhen the order was delivered to the table

detalle_orden

Line-item detail for every product within an order. Each row tracks its own preparation lifecycle independently.
ColumnTypeNotes
id_detalleINT PKAuto-increment surrogate key
id_ordenINT FKReferences ordenes.id_orden
id_productoINT FKReferences productos.id
cantidadINTNumber of units ordered
precio_unitarioDECIMAL(10,2)Price at time of order (snapshot, not a live FK)
estado_itemENUMpendienteen_preparacionlistoentregado
fecha_inicio_preparacionDATETIMESet when kitchen/barista starts the item
fecha_listaDATETIMESet when the item is ready for collection
fecha_entregaDATETIMESet when the waiter delivers the item
observacionesTEXTPer-item special instructions from the customer

vw_detalle_preparacion (view)

A read-only view that joins ordenes, detalle_orden, productos, categorias, and mesas into a single flat result set. It adds the computed column area_preparacion, which categorises every line item as barista, cocina, or ignorar. Kitchen and barista screens query this view directly to filter their own queues without duplicating the routing logic in PHP.

Category Routing Rules

The area_preparacion column in vw_detalle_preparacion is derived at query time from each product’s category slug. The rules are:
categorias.slugarea_preparacionVisible to
cafes, bebidasbaristaBarista screen
Anything else except mesascocinaKitchen screen
mesasignorarNeither screen
To add a new preparation area in a future version, introduce a new slug value and extend the CASE expression inside vw_detalle_preparacion. No PHP code changes are needed for the routing itself.
The mesas category represents table-service charges or cover items that require no preparation. Assigning a product to this category removes it from both the kitchen and barista queues entirely.

Seed Data

db/la_comanda.sql includes the following reference data, which is loaded automatically by the MySQL Docker container on first start:
ObjectCountDetails
Roles4admin, mesero, cocina, barista
Users22Sample staff accounts covering all four roles, passwords are bcrypt-hashed
Tables12Numbered 1–12, all initially disponible
Categories6Mesas, Cafés, Comidas, Especialidades, Postres, Bebidas Frías
Products60Distributed across all six categories with realistic prices
The seeded user passwords are for demonstration only. Replace them immediately in any environment that is accessible from a network, using the admin panel’s user management screen or a direct UPDATE statement with a freshly generated bcrypt hash.

Resetting the Database

To wipe all data and reimport the schema and seed data from scratch, stop the stack, remove the named volume, and rebuild:
docker compose down -v && docker compose up --build
The -v flag deletes the persistent MySQL volume. On the next up, Docker re-imports db/la_comanda.sql as if the container had never run before.
This operation is irreversible. All orders, custom layouts, and user accounts created since the last seed will be permanently deleted.

Accessing MySQL Directly

For ad-hoc queries, schema inspection, or manual data fixes, open an interactive MySQL session inside the running container:
# Open a root shell inside the MySQL container
docker exec -it la-comanda-db mysql -u root -p
You will be prompted for the MYSQL_ROOT_PASSWORD defined in your .env. Once connected, switch to the application database:
USE la_comanda;

-- List all tables
SHOW TABLES;

-- Inspect a table's structure
DESCRIBE detalle_orden;
Prefer connecting as lacomanda_user (DB_USER) for read queries so you exercise the same privilege boundary as the application. Use the root account only when schema-level changes are required.

Build docs developers (and LLMs) love