Yakult App uses MySQL as its primary data store. All sales orders, client records, products, user accounts, notifications, and generated reports are persisted in a single database namedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/160906/Yakultt-App/llms.txt
Use this file to discover all available pages before exploring further.
yakult_db. The backend is designed to manage its own schema — on every startup it inspects the database and applies any missing tables, columns, or indexes automatically. You only need to create the empty database and supply valid credentials; the rest is handled for you.
Requirements
- MySQL 8.0+ (recommended) — older 5.7 installations may work but are not tested
- Database name:
yakult_db - A MySQL user with
CREATE,ALTER,INDEX,INSERT,UPDATE,DELETE, andSELECTprivileges onyakult_db
Setup
Install and start MySQL
Choose the installation method that best fits your environment.Option A — XAMPP (Windows, zero-config):
- Download and install XAMPP from apachefriends.org.
- Open the XAMPP Control Panel and click Start next to MySQL.
- MySQL is now running on
127.0.0.1:3306with userrootand no password.
Create the database
Connect to your MySQL server with a client of your choice (MySQL CLI, phpMyAdmin, MySQL Workbench, or DBeaver) and run:That is all that is required. The backend will create and maintain all tables automatically when it starts.
(Optional) Import the seed file
A seed SQL file is included in the repository at If your MySQL user has a password, add the This step is optional — the auto-migration on server startup will create all tables even without running the seed file. Import it only if you want pre-populated sample product data.
backend/database/yakult_db.sql. It contains the full CREATE TABLE statements and a small set of sample productos records that are useful for development and testing.-p flag:Update the backend connection config
Open
backend/db.js and set the credentials to match your MySQL installation.On Windows, using
'localhost' as the host can cause MySQL to attempt an IPv6 connection (::1) before falling back to IPv4, which sometimes results in an ETIMEDOUT error even when the server is running. Using '127.0.0.1' explicitly forces an IPv4 TCP connection and avoids this issue.Start the backend and verify auto-migration
Start the backend server as described in the Backend Setup guide.On startup you will see the schema migration run before the server begins listening:If there are any connection problems, the process will exit and print a descriptive error:Double-check that MySQL is running and that the credentials in
db.js are correct.Auto-migration system
The backend includes a schema management module atbackend/schema.js that runs the ensureSchema() function on every startup. You do not need to run any manual migration commands — the server maintains its own database structure.
ensureSchema() performs the following operations each time the server starts:
- Creates missing tables — if a table does not exist, it is created with its full column and constraint definitions
- Adds missing columns — if a table exists but is missing a column (e.g. after a code update), the column is added with
ALTER TABLE ... ADD COLUMN - Creates missing indexes — any indexes defined in the schema that are absent from the live table are created
- Never destructive — no existing tables, columns, rows, or indexes are ever dropped or modified; all operations are additive only
Managed tables
The following 7 tables are created and maintained byensureSchema():
| Table | Description |
|---|---|
productos | Yakult product catalogue (SKUs, names, prices) |
clientes | Customer / distributor client records |
usuarios | Application user accounts and roles |
ordenes | Sales order headers (client, date, status, totals) |
orden_items | Line items belonging to each order (product, qty, price) |
notificaciones | In-app notifications for users |
reportes_ventas | Persisted sales report snapshots |
Connection pool reference
Themysql2/promise pool in db.js is shared across the entire application. Key configuration options:
| Option | Value | Description |
|---|---|---|
host | 127.0.0.1 | MySQL server address |
port | 3306 | MySQL server port |
user | root | MySQL username |
password | “ | MySQL password (empty by default) |
database | yakult_db | Target database name |
waitForConnections | true | Queue requests when all connections are busy, rather than throwing immediately |
connectTimeout | 10000 | Milliseconds to wait for a new connection before raising an error |