Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JAQA20/Paradigmas-G3/llms.txt

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

The La Comanda backend is an Express 5 server running on port 3000 (configurable via the PORT environment variable). It serves a REST API consumed by the React frontend and is orchestrated alongside the frontend and a MySQL 8 database via Docker Compose. All responses are JSON; no authentication is required for the currently available endpoints.

Base URL

In local development the backend container is exposed at:
http://localhost:3000
The frontend Vite dev server (http://localhost:5173) communicates with the backend using the VITE_API_URL environment variable, which Docker Compose sets to http://localhost:3000.

Configuration

CORS is enabled globally so that the frontend origin can call the API without browser restrictions. JSON body parsing is also wired in as a top-level middleware, making request bodies available on req.body for all routes. The complete src/index.ts bootstrap is:
import express from 'express';
import cors from 'cors';

const app = express();
const port = process.env.PORT || 3000;

app.use(cors());
app.use(express.json());

app.get('/', (req, res) => {
  res.json({ message: 'Welcome to La Comanda API' });
});

app.get('/api/health', (req, res) => {
  res.json({ status: 'ok', timestamp: new Date().toISOString() });
});

app.listen(port, () => {
  console.log(`Server is running on port ${port}`);
});
dotenv is declared as a production dependency so that a .env file in the backend root can supply PORT and DATABASE_URL without modifying Docker Compose. The TypeScript compiler targets ES2022 with strict checks enabled (tsconfig.json "strict": true).

Endpoints

GET /

Returns a static welcome message. Use this to confirm the server process is reachable. Authentication: None required. Response shape:
{ "message": "Welcome to La Comanda API" }
Example:
curl http://localhost:3000/
{ "message": "Welcome to La Comanda API" }

GET /api/health

Health check endpoint. Returns a fixed "ok" status and the server’s current UTC timestamp in ISO 8601 format. Suitable for container health probes and uptime monitors. Authentication: None required. Response shape:
{ "status": "ok", "timestamp": "<ISO 8601 datetime>" }
Example:
curl http://localhost:3000/api/health
{ "status": "ok", "timestamp": "2025-07-14T18:30:00.000Z" }
The timestamp field is generated server-side via new Date().toISOString() on every request, so it always reflects the actual wall-clock time at the moment of the call.

Development

The backend package.json exposes three npm scripts:
ScriptCommandPurpose
devnodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.tsHot-reloading dev server via ts-node
buildtscCompile TypeScript to dist/
startnode dist/index.jsRun the compiled production bundle
Start the development server with:
npm run dev
Nodemon watches all .ts files under src/ and restarts automatically on save. For a production build:
npm run build   # emits to dist/
npm start       # runs dist/index.js
The TypeScript compiler targets ES2022, outputs CommonJS modules ("module": "commonjs"), and enforces strict mode — all source files live under src/ and output lands in dist/.

Docker Compose

The full stack (frontend + backend + MySQL 8) is defined in docker-compose.yml. Relevant backend service configuration:
backend:
  build:
    context: ./backend
  container_name: lacomanda_backend
  ports:
    - "3000:3000"
  environment:
    - DATABASE_URL=mysql://root:rootpassword@db:3306/la_comanda
    - PORT=3000
  depends_on:
    - db
The DATABASE_URL connection string follows Prisma’s MySQL format and targets the lacomanda_db MySQL 8 container. The db service uses a named Docker volume (mysql_data) for data persistence across container restarts.

Prisma

The backend ships with @prisma/client (^7.8.0) and the prisma CLI as a dev dependency, but no schema or migrations have been committed to the repository yet. To begin defining data models:
npx prisma init
This creates prisma/schema.prisma (configure the datasource block to use provider = "mysql" and the DATABASE_URL env var) and a .env template. After editing the schema, generate the client with:
npx prisma migrate dev --name init
npx prisma generate
The API is under active development. Currently only two endpoints exist (GET / and GET /api/health); additional resource endpoints covering tables, kitchen tickets, products, and staff will be added as the backend expands to match the frontend data model.

Build docs developers (and LLMs) love