Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/teofilobetancourt/Tradiciones-y-Sabores/llms.txt

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

Tradiciones y Sabores exposes a FastAPI REST backend that listens on port 5000. Every resource endpoint is mounted under the /api/ prefix. Interactive documentation is available at /api/docs (Swagger UI) and the raw OpenAPI 3 specification is served at /api/openapi.json. The API is built for internal-network use: there is no token or session-based authentication layer — all routes are open to any caller that can reach the host.

Base URL

EnvironmentBase URL
Local developmenthttp://localhost:5000
Production / VPShttp://<host>:5000

General Conventions

  • API version: 1.1.0 (reflected in the OpenAPI info.version field and the GET /api/ health response)
  • Content type: All request and response bodies are application/json
  • Authentication: None — the system is designed for closed internal networks
  • Auto-docs: Swagger UI at /api/docs, OpenAPI JSON at /api/openapi.json

CORS Policy

CORS is configured at startup via the CORS_ORIGINS environment variable. At runtime the middleware is applied with allow_origins=["*"], permitting requests from any origin. To restrict access, set CORS_ORIGINS to a comma-separated list of allowed origins (e.g. http://localhost:5173,http://158.220.100.226).
# Example .env override
CORS_ORIGINS=http://localhost:5173,http://192.168.1.100
Even with CORS_ORIGINS scoped to specific origins in the environment, the middleware currently passes allow_origins=["*"] at the FastAPI level. Restricting CORS to specific hosts requires updating main.py to forward the parsed origins list to CORSMiddleware.

Health Endpoints

Two lightweight endpoints confirm that the service and database connection are alive.
MethodPathResponse
GET/{"status": "ok", "servicio": "Tradiciones y Sabores API", "db_integration": "nelrondon/restaurant-bd-tdb"}
GET/api/{"status": "ok", "servicio": "Tradiciones y Sabores API", "version": "1.1.0"}
GET/api/debugDB connection status, env vars, and live plato row count
Use GET /api/debug during initial deployment to verify that all four database environment variables (DB_HOST, DB_PORT, DB_NAME, DB_USER) are correctly resolved and that the ORM can reach PostgreSQL.

Frontend Proxy Layer

The React frontend makes all API requests using relative /api/v1/ paths (e.g. /api/v1/ordenes). In production, Nginx intercepts these requests and rewrites the path before forwarding them to the FastAPI backend on port 5000:
Browser → /api/v1/ordenes
       ↓  Nginx rewrite
Backend → /api/ordenes  (port 5000)
When calling the API directly — for example with curl, Postman, or any backend-to-backend integration — always use the /api/ paths on port 5000 as documented in the reference tables below. The /api/v1/ prefix only exists in the Nginx proxy configuration and is never seen by FastAPI.
If you observe a 404 Not Found from FastAPI when testing endpoints directly, check that you are using /api/ordenes (not /api/v1/ordenes). The backend has no /v1 prefix — that segment is stripped by Nginx before the request arrives.

Endpoint Reference

The table below lists every resource route registered in the application. Alias paths (/api/pedidos, /api/productos) behave identically to their primary counterparts and are noted separately.

Orders — /api/ordenes

MethodPathDescription
GET/api/ordenesList all orders; optional ?estatus=activo filter returns only recibido and preparando states
GET/api/ordenes/{num_ticket}Retrieve a single order by ticket number, including client info and line items
POST/api/ordenesCreate a new order with client, line items, and an auto-generated invoice
PUT/api/ordenes/{num_ticket}Update the estado_orden of an existing order
DELETE/api/ordenes/{num_ticket}Cancel and permanently remove an order along with its invoice and line items
/api/pedidos is a registered alias for /api/ordenes. All five methods (GET, GET /{num_ticket}, POST, PUT /{num_ticket}, DELETE /{num_ticket}) are available on both prefixes with identical behavior.
MethodPathDescription
GET/api/platosList all menu items; optional ?categoria=<value> filter by CategoriaPlatoEnum
POST/api/platosCreate a new menu item (dish)
/api/productos is a registered backward-compatibility alias for /api/platos. GET /api/productos returns the same list with an additional id_producto alias field for legacy frontend support.

Inventory — /api/inventario

MethodPathDescription
GET/api/inventarioList all supply items (Insumos) ordered by name
POST/api/inventarioCreate a new inventory item
PUT/api/inventario/{id}Update stock levels, unit, or name of an existing item
DELETE/api/inventario/{id}Remove an inventory item (HTTP 204 No Content)

Suppliers — /api/proveedores

MethodPathDescription
GET/api/proveedoresList all suppliers ordered by company name
POST/api/proveedoresRegister a new supplier
PUT/api/proveedores/{id}Update supplier contact or identification details
DELETE/api/proveedores/{id}Remove a supplier record (HTTP 204 No Content)

Reports — /api/reportes

MethodPathDescription
GET/api/reportes/resumenDashboard KPIs: total orders, gross revenue, avg. completion time, and period-over-period % change for the last 30 days
GET/api/reportes/pedidosFiltered order list for reporting; supports ?estado=<value> and ?periodo=hoy|semana|mes

Diagnostics

MethodPathDescription
GET/api/debugReturns DB connection status, environment variable values, and a live count of plato rows

Explore by Module

Orders

Create, retrieve, update, and cancel orders. Includes automatic invoice generation on POST.

Menu

Browse and manage the restaurant’s dish catalogue, filterable by category.

Inventory

Track supply items, stock levels, reorder points, and unit measures.

Suppliers

Manage vendor records including RIF identification, contact details, and location.

Reports

Dashboard KPI summaries and period-filtered order tables for analytics.

Build docs developers (and LLMs) love