Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Hansel-Pan/sistema-de-informacion-web-para-un-gimnasio/llms.txt

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

GymSys is a frontend-only React application. It does not bundle or ship a backend server — instead, it communicates with a separate REST API over HTTP. Before running the frontend, you must have a compatible backend implementation running locally (or remotely) that exposes the endpoints described on this page.

Required API Base URL

All API calls in GymSys originate from a single constant defined at the top of services/api.js:
const API = "http://localhost:3001/api";
Every request the frontend makes is prefixed with this value. If your backend runs on a different host or port, this is the only line you need to change. See the Environment Configuration page for how to make this value configurable without modifying source code.

Required Endpoints

The table below lists every endpoint the frontend calls, grouped by resource. Your backend implementation must respond to all of them.
MethodPathDescription
GET/api/clientesReturns an array of all client objects
GET/api/clientes/:idReturns a single client object by ID
POST/api/clientesCreates a new client
PUT/api/clientes/:idUpdates an existing client by ID
DELETE/api/clientes/:idDeletes a client by ID
GET/api/pagosReturns an array of all payment records
POST/api/pagosCreates a new payment record
POST/api/acceso/entradaRecords a client entry event
POST/api/acceso/salidaRecords a client exit event
GET/api/acceso/ocupacionReturns an array of clients currently inside the gym
GET/api/acceso/historial/:cliente_idReturns the full access history for a given client

Expected Response Fields

The frontend reads specific fields from the JSON responses returned by your backend. Returning unexpected field names or omitting required ones will cause the UI to render incorrectly or throw errors.

Client object (/api/clientes)

FieldTypeDescription
idnumberUnique client identifier
nombresstringClient’s full name
identificacionstringNational ID or document number
celularstringMobile phone number
fecha_inscripcionstringEnrollment date (ISO 8601 recommended)
generostringGender (M or F)
dias_restantesnumberRemaining active membership days
en_gimnasiobooleanWhether the client is currently inside the gym

Payment object (/api/pagos)

FieldTypeDescription
idnumberUnique payment identifier
nombresstringClient’s full name (denormalized for display)
identificacionstringClient’s document number
fecha_pagostringDate the payment was recorded (ISO 8601 recommended)
dias_contratadosnumberNumber of membership days purchased
totalnumberTotal amount charged

Error Handling

All HTTP requests are routed through the peticion() helper function in services/api.js. On non-OK HTTP status codes, the function reads the error field from the JSON response body and throws it as a JavaScript Error. This means your backend must return a JSON object with an error string property whenever it responds with a 4xx or 5xx status code.
async function peticion(url, options = {}) {
  
  const res = await fetch(`${API}${url}`, {
    headers: { "Content-Type": "application/json" },
    ...options,
  });
  
  const data = await res.json();
  if (!res.ok) throw new Error(data.error || "Error en la petición");
  return data;
}
Example error response shape your backend should return on failure:
{
  "error": "Cliente no encontrado"
}
If the error field is absent, the frontend falls back to the generic message "Error en la petición".
CORS must be enabled on your backend to allow requests from the Vite development server, which runs at http://localhost:5173 by default. In production, set the allowed origin to match your deployed frontend domain. See the Environment Configuration page for a sample backend .env that includes CORS_ORIGIN.

Build docs developers (and LLMs) love