Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ytabeloved/ordervista/llms.txt

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

Ordervista uses a relational MySQL database to store all application data, including users, products, orders, and operational records. In production the database is hosted on Aiven MySQL, a managed cloud database service that enforces SSL on every connection. Before the application can run — locally or in production — the schema must be created and the required lookup data must be seeded into the database.

Schema Overview

The Ordervista database consists of 10 tables that model the full restaurant order-management domain:
TableDescription
ROLESUser role definitions (Administrador, Operador, Cliente)
USUARIOSRegistered application users
CATEGORIASProduct menu categories
PRODUCTOSMenu items including price, stock, and image
PEDIDOSCustomer and operator orders
DETALLE_PEDIDOLine items belonging to each order
ESTADOS_PEDIDOLookup table of order status values
TIPOS_PEDIDOLookup table of order type values (Delivery, Retiro, Consumo Local)
DIRECCIONESDelivery addresses linked to users
COMANDASKitchen command records linked to orders
The full table definitions — including columns, types, constraints, and foreign keys — are in backend/src/config/schema.sql.

Initializing the Schema

Run the schema SQL file against your target database using the MySQL CLI. Replace the placeholders with the connection details from your Aiven (or local) service:
mysql -h <host> -P <port> -u <user> -p <database> < backend/src/config/schema.sql
You will be prompted for the password after running the command. For a local MySQL instance this typically looks like:
mysql -h localhost -P 3306 -u root -p ordervista < backend/src/config/schema.sql
For Aiven MySQL, copy the host and port from the Aiven service overview page and use defaultdb as the database name unless you created a custom one.

Seeding Initial Data

Several tables must be populated with required lookup data before the application can function correctly. The seed file backend/src/config/seed.sql inserts the initial rows for:
  • ROLES — the three application roles: Administrador, Operador, and Cliente
  • ESTADOS_PEDIDO — the four order status values: Pendiente, En preparación, Listo, and Entregado
  • TIPOS_PEDIDO — the three order type values: Delivery, Retiro, and Consumo Local
Run the seed file the same way as the schema file:
mysql -h <host> -P <port> -u <user> -p <database> < backend/src/config/seed.sql

Aiven MySQL Connection

Aiven MySQL requires SSL for all connections. The backend’s connection pool in backend/src/config/db.js reads the following environment variables to configure SSL:
DB_SSL=true
DB_SSL_REJECT_UNAUTHORIZED=false
Setting DB_SSL=true activates the SSL configuration path in getSslConfig(). Setting DB_SSL_REJECT_UNAUTHORIZED=false tells the MySQL2 client to accept Aiven’s managed certificate without needing a local CA bundle. All other connection parameters (DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME) should be copied directly from the Connection Information panel in the Aiven console.
Aiven also provides a DATABASE_URL connection string on the service overview page. If you prefer a single-variable approach, set DATABASE_URL in the backend environment and omit the individual DB_* variables — the connection pool will parse the URL automatically.

Local MySQL

For local development, SSL is not required. Use the following settings in backend/.env:
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=<your-local-password>
DB_NAME=ordervista
DB_SSL=false
DB_SSL_REJECT_UNAUTHORIZED=false
Create the local database manually before running the schema and seed scripts:
CREATE DATABASE ordervista CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
On Linux hosts such as Render, the MySQL server treats table names as case-sensitive because the underlying filesystem is case-sensitive. Ordervista intentionally uses uppercase table names throughout (e.g. PEDIDOS, not pedidos). Do not rename tables to lowercase — doing so will cause query failures when the application is deployed to Render. Always preserve the uppercase naming convention when writing custom queries or migrations.

Build docs developers (and LLMs) love