Blueprint

News & crypto feeds

News APIs, combined feeds, and cron-fed pipelines.

Overview

News is served primarily under /api/news/*, backed by getNewsDataService in src/services/news-data.ts and types in src/types/news-data.ts. Middleware helpers in src/lib/news-data-middleware.ts provide fallback and sanitization (withFallback, sanitizeNewsItems).

Representative routes

PathPurpose
GET /api/news/itemsPaginated/filtered news items (category, tags, language, featured, priority, search, sort)
GET /api/news/items/[uuid]Single item
GET /api/news/items family + home, all, articles, search, dual-language, chinese-crypto, newsflash-combined, binance-alpha, twitter, twitter/[identifier], channels, channels/[uuid], stats, healthAggregations, feeds, and health checks

Cron relationship

  • /api/cron/crypto-news and related cron jobs (see content/docs/architecture/cron) ingest or refresh external/crypto content; /api/news/* is the read/query surface for the app UI and integrations.

Data flow

  1. Ingest pipelines (cron or admin) write to the news store.
  2. Clients call GET /api/news/... with query params.
  3. Service layer applies filters; middleware may attach fallbacks when upstream data is partial.

Key files

  • src/app/api/news/**/route.ts
  • src/services/news-data.ts
  • src/lib/news-data-middleware.ts

Dependencies

Environment

  • DATABASE_URL — read path is DB-backed (getNewsDataService).
  • RSS / third-party keys for ingestion live in cron and fetch code paths (see Cron), not always in the GET handlers.

Database (src/db/schema.ts)

  • news_items_cache, binance_alpha_news_cache, articles_cache, twitter_accounts_cache, channels_cache
News & crypto feeds | Tracker Dog Docs