CoffePrice surfaces live coffee purchase prices posted by approved buyers across Huila. Each price record is tied to a specific buyer (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JaiderT/CoffeePrice/llms.txt
Use this file to discover all available pages before exploring further.
comprador) and coffee type (tipocafe), and is visible to any producer or visitor via the public API — no login required. Prices are kept fresh by an automated cron job that pulls the official FNC reference price twice every business day and by buyers themselves updating their offers in real time.
How Price Data Is Collected
Price data flows from two sources that work in tandem.Primary: FNC website scrape
A Puppeteer headless-browser job navigates to
https://federaciondecafeteros.org/wp/listado-precios-cafe/ and extracts the first numeric value in the COP range 800,000 – 8,000,000. This gives the official Federación Nacional de Cafeteros (FNC) price per carga.Fallback: New York KC=F futures
If Puppeteer fails (network timeout, DOM change, etc.), the system queries the Yahoo Finance endpoint The converted value is validated to be within 800,000–8,000,000 COP before being accepted.
KC=F for the current arabica futures price in US cents/lb and converts it to COP/carga using a calibrated formula.Calibration factor (April 2025): NY = 300.9 ¢/lb → FNC = 2,200,000 COP/carga.The FNC source tag in the cache is
fnc-directo when the scrape succeeds, or ny-estimado when the fallback conversion is used. You can inspect the active source from the price metadata returned by the API.Supported Coffee Types
Every price record specifies atipocafe. The platform supports the following commodities:
tipocafe | Unit | Description |
|---|---|---|
pergamino_seco | carga | Dry parchment coffee (standard) |
especial | carga | Specialty-grade coffee |
organico | carga | Certified organic coffee |
verde | carga | Green (unprocessed) coffee |
pasilla | kg | Sub-grade / broken beans |
cacao | kg | Cacao (complementary crop) |
limon | kg | Lemon (complementary crop) |
Price Unit Logic
The model stores two price fields and derives one automatically on save:preciocarga— the canonical price entered by the buyer (always required, always > 0).preciokg— computed by a Mongoose pre-save hook:- For carga types (
pergamino_seco,especial,organico,verde):preciokg = Math.round(preciocarga / 125). - For kg types (
pasilla,cacao,limon):preciokg = preciocarga(price per kg is the primary unit;preciocargastores the same value).
- For carga types (
unidad— set to'carga'or'kg'automatically based ontipocafe.
Public API
List All Active Buyer Prices
preciocarga descending. Duplicate buyers are deduplicated — only the most recent price per buyer is shown. Contact details are stripped from the buyer object; only _id, nombreempresa, and direccion are exposed.
Optional query parameter:
| Parameter | Type | Description |
|---|---|---|
tipocafe | string | Filter by coffee type (e.g. pergamino_seco) |
Prices by Buyer
Buyer Price Management
Buyers (comprador role) and admins can manage their own price listings. All write operations require a valid JWT and the comprador or admin role.
Create Price
POST /api/preciosRequired fields: comprador (ObjectId), preciocarga (number > 0), tipocafe (enum). A duplicate-suppression window of 60 seconds prevents accidental double-posts.Update Price
PUT /api/precios/:idAccepts preciocarga and/or tipocafe. Only the owner buyer or an admin may update. Updates are written to the price history log automatically.Delete Price
DELETE /api/precios/:idPermanently removes the price record. Ownership or admin role required.Alert Integration
Every time a buyer creates (POST) or updates (PUT) a price, the system automatically checks all active producer alerts:
- The controller queries
Alertafor records whereactiva: true,precioMinimo <= preciocarga, and the alert’scompradoreither matches the posting buyer or isnull(watch-all alerts). - For each matching alert with
canales.email: true, an email is dispatched via Nodemailer with the producer’s name, the buyer’s company name, the alert threshold, and the actual posted price. ultimaNotificacionis updated on each triggered alert to timestamp the last dispatch.