News Aggregator - Project Context
Documents a React news aggregator with global intelligence, serverless functions, and multiple external API integrations.
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
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.cjsserverless function - Actions:
trending- Fetches trending topics for a country from GDELTregulatory- Fetches regulatory news for a country/topictrending-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
| Function | Purpose |
|---|---|
global-intel.cjs | Global trending, regulatory data, batch map data |
rss-proxy.cjs | RSS feed proxy |
gdelt-proxy.cjs | GDELT API proxy |
pinecone-search.cjs | Semantic search via Pinecone |
ft-scraper.cjs | Financial Times scraping |
finance-scraper.cjs | Finance data scraping |
Environment Variables
Required in .env.local:
PERPLEXITY_API_KEYPINECONE_API_KEYPINECONE_INDEX_HOSTFT_MYFT_RSS_URLFT_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:
- URL path patterns (e.g.,
/afrique/,/mundo/) - Character detection (non-Latin scripts)
- 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_COOKIEwith your own credentials - Replace
JoseLFernandez/news_agentrepository references with your own repo name - Replace
lemonde.frand 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
System Prompt
Defines the identity, capabilities, response style, and spec workflow for an AI assistant named Kiro that helps developers build features incrementally.
World Engine AI Coding Instructions
Defines game scope, architecture, ESLint rules, git workflow, and open-source research policy for a strategic fantasy RPG project.
GitHub Copilot Instructions
Defines coding standards, architecture rules, PR expectations, and output format for a Laravel + Inertia + Vue 3 project.
Business Intelligence Dashboard - Comprehensive GitHub Copilot Instructions
Defines the full stack, setup commands, security rules, and testing strategy for a Next.js SaaS analytics platform with multi-tenant isolation.