How mojmo/keepeyesonsudan works
Project type and purpose
• Full-stack awareness web application.
• Frontend: React + Vite + TypeScript; Backend: Node.js + Express (proxy to Reddit API).
• Fetches news, social posts, and statistics to inform users about the Sudan crisis.
File structure
• Top level
– package.json, vite.config.ts, tsconfig*.json → build tooling/config
– index.html, public/ → static assets and CSV data (refugees.csv)
• src/ → React app
– components/, pages/, styles/, utils/ (newsApi.ts, redditApi.ts)
– Router.tsx, App.tsx, main.tsx
• api/ → Express server
– index.js, .env.template, package.json, vercel.json
Extract key insights from the README
• Client calls two external APIs: GNews (NewsAPI) and Reddit (via local Express proxy).
• Visualizes UNHCR data (via public CSV or direct fetch).
• Responsive, mobile-first UI.
A. Client/Browser (User’s web browser)
B. Frontend Application
• React + Vite dev server / built static assets (index.html, JS bundle)
• UI modules: Carousel, Hero, News, SocialMedia, StatisticsChart, etc.
C. Backend Service
• Express.js proxy that securely holds Reddit credentials
• Exposes endpoints for frontend to fetch Reddit posts
D. External Services
• GNewsAPI (NewsAPI)
• Reddit API
• UNHCR (data.unhcr.org) or public/data/refugees.csv
E. Static Hosting / CDN
• Netlify / Vercel (serves built frontend & runs Express as serverless function)
Relationships & data flows
1) Browser → Frontend UI (loads HTML/JS/CSS)
2) Frontend → GNewsAPI (direct fetch using VITE_GNEWS_API_KEY)
3) Frontend → Express backend (/api/reddit)
4) Express → Reddit API (client credential flow)
5) Frontend → UNHCR or CSV data (static fetch)
6) All responses flow back to Browser to render components
Architectural patterns & principles
• Separation of concerns: UI vs. API proxy
• Single-Page Application (SPA) with client-side routing (Router.tsx)
• Environment variable isolation for secrets (NewsAPI key in client, Reddit creds in server)
• Static asset hosting + serverless functions (api/vercel.json)