Back to .md Directory

News Aggregator - Project Context

Documents a React news aggregator with global intelligence, serverless functions, and multiple external API integrations.

May 2, 2026
0 downloads
0 views
ai
View source

What this file does

Documents a React news aggregator with global intelligence, serverless functions, and multiple external API integrations.

When to use it

  • Building a news aggregator with multilingual support
  • Using GDELT, Pinecone, or MyMemory APIs in a React app
  • Deploying serverless functions with Netlify
  • Organizing a React project with multiple data sources

Assumes this stack

React 18TypeScriptTailwindCSSReact QueryNetlify FunctionsPinecone

News Aggregator - Project Context

Overview

A React-based news aggregator with global intelligence features, built with Vite and deployed on Netlify.

Tech Stack

  • Frontend: React 18, TypeScript, TailwindCSS, React Query
  • Backend: Netlify Functions (serverless)
  • APIs: GDELT (news data), MyMemory (translation), Pinecone (semantic search)
  • Routing: React Router v6

Project Structure

src/
├── api/           # API hooks (React Query)
├── components/
│   ├── articles/  # Article display components
│   ├── filters/   # Topic and date filters
│   ├── global/    # Global intelligence widgets
│   ├── layout/    # Header, Sidebar, MainLayout
│   └── search/    # Search modal
├── config/        # Country configurations
├── hooks/         # Custom React hooks
├── pages/         # Route pages (HomePage, GlobalDashboard, TopicPage)
├── types/         # TypeScript type definitions
└── utils/         # Utility functions

netlify/functions/  # Serverless functions (.cjs files)

Key Features

Global News Tab (/global)

  • Components: GlobalDashboard.tsx, TrendingByCountry.tsx, RegulatoryRadar.tsx, EuropeMap.tsx
  • API: global-intel.cjs serverless function
  • Actions:
    • trending - Fetches trending topics for a country from GDELT
    • regulatory - Fetches regulatory news for a country/topic
    • trending-batch - Returns pre-computed heat data for Europe map (optimized for speed)

Language & Translation

  • Language selector supports: EN, FR, DE, ES, IT, PT, NL, PL
  • Each language has domain-specific news sources (e.g., lemonde.fr for French)
  • Translation toggle uses MyMemory API to translate titles to English
  • Original titles preserved in article.originalTitle

Topic Categories

Valid TrendingCategory values: technology, business, politics, science, culture, sports

Netlify Functions

FunctionPurpose
global-intel.cjsGlobal trending, regulatory data, batch map data
rss-proxy.cjsRSS feed proxy
gdelt-proxy.cjsGDELT API proxy
pinecone-search.cjsSemantic search via Pinecone
ft-scraper.cjsFinancial Times scraping
finance-scraper.cjsFinance data scraping

Environment Variables

Required in .env.local:

  • PERPLEXITY_API_KEY
  • PINECONE_API_KEY
  • PINECONE_INDEX_HOST
  • FT_MYFT_RSS_URL
  • FT_SESSION_COOKIE

Development Commands

npm run dev          # Start Vite dev server (port 5173)
npx netlify dev      # Start with Netlify functions (port 8888)
npm run build        # Production build

Common Patterns

GDELT Filtering

Articles are filtered for language using:

  1. URL path patterns (e.g., /afrique/, /mundo/)
  2. Character detection (non-Latin scripts)
  3. Common word matching (language-specific)

Category Priority

Articles are assigned ONE category based on priority order: politics > technology > business > science > sports > culture

Known Considerations

  • GDELT has a 250 record limit per request
  • Netlify functions have 30-second timeout
  • Europe map uses pre-computed heat values (not real-time) for performance
  • Translation limited to 5 articles per topic to avoid rate limits

What's inside

1 overview, 1 tech stack, 1 project structure, 4 key features, 6 Netlify functions, 1 env vars table, 3 commands, 3 common patterns, 4 known considerations

Change this for your project

  • Replace PERPLEXITY_API_KEY, PINECONE_API_KEY, PINECONE_INDEX_HOST, FT_MYFT_RSS_URL, FT_SESSION_COOKIE with your own credentials
  • Replace JoseLFernandez/news_agent repository references with your own repo name
  • Replace lemonde.fr and other domain-specific news sources with your own sources

Where it goes

Keep it in your repository where the agent or team that needs it will read it.

Worth borrowing

  • Using a priority-based category assignment for articles to avoid duplicates
  • Pre-computing map heat data for performance instead of real-time queries
  • Filtering articles by language using URL patterns, character detection, and common word matching

Related Documents