Skip to main content

Prerequisites

  • Node.js >= 18
  • npm >= 9

Run locally

1

Clone the repository and install dependencies

git clone https://github.com/sebasgao05/duitama-taxi-pricing.git
cd duitama-taxi-pricing
npm install
2

Configure environment variables

Copy the example environment file to create your local .env:
cp .env.example .env
The default values are ready to use for local development:
.env
PORT=3000
NODE_ENV=development
3

Start the development server

npm run dev
The server starts with hot-reload enabled. You should see output confirming the API and docs URLs are available.
4

Make your first fare calculation

Send a POST request with the origin and destination neighborhood names:
curl -X POST http://localhost:3000/api/v2026/calculate-fare \
  -H "Content-Type: application/json" \
  -d '{"origen":"San Fernando","destino":"Centro"}'
The API responds with the calculated fare and full traceability details:
{
  "success": true,
  "timestamp": "2026-03-10T14:30:00.000Z",
  "request_id": "a1b2c3d4-e5f6-4789-abcd-ef1234567890",
  "data": {
    "origen": "San Fernando",
    "destino": "Centro",
    "hora_consulta": "09:30",
    "fecha_consulta": "2026-03-10",
    "fuente": "barrios.json → primer_sector",
    "tarifa": 7000,
    "tipo": "diurna",
    "sector_aplicado": "primer sector",
    "detalle": "Tarifa base primer sector diurna",
    "recargos": []
  }
}
The tarifa field is the fare in Colombian pesos (COP). The tipo field is either "diurna" (day rate) or "nocturna" (night rate, applied from 7:00 p.m. to 5:59 a.m.). The recargos array lists any active surcharges, such as the $600 COP holiday surcharge applied on Jueves/Viernes Santo and December 16–31.
Before testing fare calculations, confirm the server is running by calling GET http://localhost:3000/health. You can also explore all endpoints interactively through the Swagger UI at http://localhost:3000/docs.

Next steps

Core concepts

Learn how fare priority works — special routes, terminal table, general sector table, night rates, and holiday surcharges.

API reference

Full request and response schemas for all endpoints, including error codes and validation rules.

Build docs developers (and LLMs) love