The Yakult App backend is an Express.js REST API that connects to a MySQL database and exposes all endpoints consumed by the mobile client. It handles authentication via JWT, manages sales orders, products, clients, and generates reports. Before starting the mobile app, you must have this server running and reachable on your network.Documentation 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.
Prerequisites
- Node.js 18+ — nodejs.org
- MySQL 8 — via XAMPP, MySQL Workbench, or a standalone MySQL Server installation
- npm (bundled with Node.js)
Setup
Install backend dependencies
Move into the
backend directory and install all required Node.js packages.Configure the MySQL connection
Open Change
backend/db.js and update the connection pool options to match your local MySQL installation.host, user, password, and database to match your environment. See the Database setup guide for full details on creating yakult_db.Set the JWT secret
The backend signs all authentication tokens using the Using a Then install
JWT_SECRET environment variable. You can set it inline for a quick start or via a .env file for persistent configuration.Inline (terminal session only):.env file (recommended):Create a file named .env inside the backend/ directory:dotenv and add require('dotenv').config() at the top of server.js, or use a package such as dotenv-cli to load it automatically.Environment variables reference
| Variable | Default | Description |
|---|---|---|
JWT_SECRET | yakult-reportes-dev-secret | Secret key used to sign and verify JWT tokens |
Start the server
Run the server in development mode (with auto-reload via A successful startup prints:
nodemon) or in production mode.On every startup,
ensureSchema() runs automatically before the server begins accepting requests. It creates all 7 required database tables if they do not yet exist, adds any missing columns to existing tables, and creates missing indexes — all operations are fully idempotent and will never delete or overwrite your existing data. See the Database guide for a full breakdown of what this migration does.Verify the server is running
Send a quick health-check request to confirm the API is responding.Expected response:If the server started but MySQL is unreachable, the process will exit before accepting any connections and print an error to the console:Ensure MySQL is running and that the credentials in
backend/db.js are correct, then start the server again.