CoffePrice maintains a continuously refreshed news feed focused on the Colombian coffee sector. Articles are sourced from up to four external news APIs, filtered for coffee-sector relevance, de-duplicated, and either adapted locally (default) or summarized by GPT-4o-mini (AI mode). The result is a curated feed producers and buyers can browse directly in the platform — no external links or sign-ups required.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.
News Sources
NewsAPI
Configured via
NEWSAPI_KEY. Broad international news coverage; articles filtered to coffee-relevant topics before publication.GNews
Configured via
GNEWS_API_KEY. European news aggregator with Spanish-language support.TheNewsAPI
Configured via
THENEWSAPI_TOKEN. Specialty coffee and agribusiness sources. Absence of this token limits the feed to direct RSS sources only.NewsData
Configured via
NEWSDATA_API_KEY. Strong coverage of Latin American agricultural news and FNC announcements.At least one API key must be configured for the news feed to populate from external sources. If no aggregator keys are set, the service falls back to direct RSS feeds in Spanish.
Auto-Generation
News generation runs automatically on two triggers:Boot-time generation
If the environment variable
NOTICIAS_GENERAR_AL_INICIAR=true is set, generarNoticiasDelDia() is called once when the Node.js server starts. This ensures fresh content is available immediately after a deployment without waiting for the next cron tick.Adaptive background refresh
The
asegurarNoticiasRecientes() function runs on a background schedule (noticiaCron.js). It checks:- Is the most recent auto-generated article older than
NOTICIAS_MAX_HORAS_SIN_ACTUALIZAR(default: 8 hours)? - Is the current inventory below
NOTICIAS_MIN_ACTIVAS(default: 6 articles) in the lastNOTICIAS_HORAS_INVENTARIO(default: 72 hours)?
NOTICIAS_MIN_INTERVALO_REVISION_MS=300000) prevents runaway polling.Environment Variables
The following variables tune the news pipeline behaviour. All are optional with the defaults shown:| Variable | Default | Description |
|---|---|---|
NEWSAPI_KEY | — | API key for newsapi.org |
GNEWS_API_KEY | — | API key for gnews.io |
THENEWSAPI_TOKEN | — | Token for thenewsapi.com |
NEWSDATA_API_KEY | — | API key for newsdata.io |
OPENAI_API_KEY | — | Required only when NOTICIAS_MODO_ADAPTACION=ia |
NOTICIAS_MODO_ADAPTACION | local | local = rule-based adaptation; ia = GPT-4o-mini summarization |
NOTICIAS_GENERAR_AL_INICIAR | false | Run a generation cycle on server boot |
NOTICIAS_POR_CICLO | 3 | Maximum new articles created per generation cycle |
NOTICIAS_DIAS_CONSERVAR | 7 | Days before auto-generated articles are deleted by limpiarNoticiasViejas |
NOTICIAS_MAX_HORAS_FUENTE | 12 | Maximum article age (hours) accepted from external sources |
NOTICIAS_MIN_ACTIVAS | 6 | Minimum active articles before a refresh cycle is triggered |
NOTICIAS_HORAS_INVENTARIO | 72 | Lookback window (hours) used when counting active articles |
NOTICIAS_BLOQUEAR_REPETIDAS_HORAS | 168 | Hours a source URL is blocked after being published (prevents recycling) |
NOTICIAS_HORAS_REVISAR_DUPLICADOS | 48 | Lookback window (hours) for in-memory duplicate checks during generation |
Relevance Filtering
Before any article is saved, the pipeline applies several quality gates:- Noise filter — articles about football, crime, entertainment, or other off-topic content are discarded using a keyword blocklist (
sub17,futbol,asesinato,farandula, etc.). - Coffee relevance check — the article must contain at least one strong coffee-sector signal (e.g.
"precio del cafe","federacion nacional de cafeteros","caficultores","pergamino"). - Forced-localization check — if the source article does not mention El Pital or Huila, the pipeline strips any injected local references from the adaptation to prevent fake regionalization.
- Duplicate detection — Jaccard similarity is calculated across title, summary, and content tokens. Articles exceeding the similarity thresholds against recently saved content are discarded.
- Source rotation — each source URL is hashed (
sourceHash) and blocked forNOTICIAS_BLOQUEAR_REPETIDAS_HORAS(default 168 h / 7 days) after publication to prevent the same article from recycling.
Admin-Only Endpoints
Trigger Manual Generation
generarNoticiasDelDia() cycle immediately and returns the count of articles created.
Example response:
Clean Damaged Articles
tema_ajeno_al_cafe, contexto_local_forzado, titulo_desalineado, contenido_insuficiente, contenido_igual_al_resumen.
Public Endpoints
| Endpoint | Description |
|---|---|
GET /api/noticias | List all published articles (paginated) |
GET /api/noticias/:id | Get full article detail by MongoDB ID |