Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FloresJesus/SS_RESTAURANT/llms.txt

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

This guide walks you from a fresh clone to a fully operational SS Restaurant instance — backend API, MySQL database, sample data, and Vue 3 frontend — in a single terminal session. By the end you will have the API running, the database seeded with sample menu items, tables, and customers, and the frontend ready to log in once you create your first admin user.

Prerequisites

Before you begin, make sure the following are available on your machine:
  • Node.js 18+ (the frontend engines field requires ^20.19.0 || >=22.12.0 for full compatibility)
  • MySQL 8+ running locally or accessible over the network
  • npm (bundled with Node.js)
  • A terminal with access to the cloned repository root

Steps

1

Clone the repository

git clone https://github.com/FloresJesus/SS_RESTAURANT.git
cd SS_RESTAURANT
2

Create the backend environment file

Create a file named .env inside the Backend/ directory. This file is read by dotenv at startup and must exist before you run the server.
# Backend/.env
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=restaurante

JWT_SECRET=replace_with_a_long_random_string

PORT=3000

IMAGEKIT_PUBLIC_KEY=your_imagekit_public_key
IMAGEKIT_PRIVATE_KEY=your_imagekit_private_key
IMAGEKIT_URL_ENDPOINT=https://ik.imagekit.io/your_imagekit_id
The three IMAGEKIT_* variables are only required if you want to upload menu item images. The rest of the application works without them.
3

Create the MySQL database

Connect to your MySQL server and create the database that matches the DB_NAME value in your .env:
CREATE DATABASE restaurante;
SS Restaurant expects the tables to already exist. Run your schema migration script (if provided) or let the application’s first requests surface any missing-table errors so you can apply them manually.
4

Install backend dependencies and start the API server

cd Backend
npm install
node server.js
You should see:
Servidor corriendo en puerto 3000
The API is now accepting requests at http://localhost:3000.
5

Seed the database with sample data

While still inside the Backend/ directory, run the seed script to populate the database with a realistic starting dataset:
node seed.js
Expected output:
Inserting seed data...
Seed complete!
The seeder inserts:
TableRecords inserted
categoria_producto4 categories: Entradas, Platos Principales, Bebidas, Postres
producto7 products: Ceviche, Empanadas, Lomo Saltado, Pollo a la Brasa, Chicha Morada, Limonada, Suspiro Limeño
mesa5 tables (capacities 2, 4, 4, 6, 8 — all libre)
cliente2 customers: Juan Perez and Maria Lopez
The seeder clears any existing rows in detalle_pedido, pedido, reserva, cliente, producto, categoria_producto, and mesa before inserting, so it is safe to re-run to reset your local data.
6

Install frontend dependencies

Open a new terminal tab, navigate to the Frontend/ directory, and install packages:
cd Frontend
npm install
7

Start the Vue 3 dev server

npm run dev
Vite will start the dev server and print something like:
VITE v7.x.x  ready in 500 ms

➜  Local:   http://localhost:5173/
➜  Network: use --host to expose
The Vite dev server is configured to proxy all /api requests to http://localhost:3000, so the frontend communicates with your local Express API automatically.
8

Create your first admin user

The seed script does not create any user accounts — it only populates menu categories, products, tables, and customers. Before you can log in you must insert an initial admin user directly in MySQL with a bcrypt-hashed password.Connect to MySQL and run:
INSERT INTO usuarios (nombre, apellido, email, password_hash, rol, activo)
VALUES (
  'Admin',
  'User',
  '[email protected]',
  '$2a$10$placeholder_replace_with_real_hash',
  'admin',
  1
);
To generate a proper bcrypt hash for your chosen password, run this one-liner from the Backend/ directory:
node -e "const b=require('bcryptjs');b.hash('your_password',10).then(h=>console.log(h))"
Copy the printed hash and use it as the password_hash value in the INSERT statement above.Once the user row exists, open your browser, go to http://localhost:5173/login, and sign in with the email and password you chose. After a successful login the API returns a JWT valid for 8 hours, which the frontend stores in localStorage and attaches to every subsequent request via the Authorization: Bearer header.Alternatively, if you already have a logged-in admin session, subsequent staff accounts can be created through the application UI or by calling POST /api/users (admin role required).

Development Tips

Install nodemon globally to automatically restart the Express server whenever you change a backend file — no more manual Ctrl+C and restart cycles:
npm install -g nodemon
cd Backend
nodemon server.js
Never use a weak or default JWT_SECRET in production. The authMiddleware.js falls back to the string "secreto" when JWT_SECRET is not set, which means any attacker can forge valid tokens for any user and role. Always set a cryptographically random secret of at least 32 characters in your production .env:
# generate a strong secret (macOS / Linux)
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Build docs developers (and LLMs) love