How shauryaverma03/automated-rag-ai-news-agent works
1. Two-part repo: offline ingestion + React presentation
- This repository is not a full API server stack in the tree. It is split into a Python ingestion pipeline at the root and a React frontend in tech-news-frontend/.
- The main architectural boundary is between data production (ingest_and_push.py) and data consumption (tech-news-frontend).
2. Python ingestion is the data source
- ingest_and_push.py is the central backend-like entry point.
- Per the README, it gathers news from external sources, extracts content, and prepares structured records and summaries.
- Its output is persisted to knowledge_base.json, which acts as the shared knowledge store for the rest of the project.
3. Knowledge base is a file-based contract
- knowledge_base.json exists at the repo root and is also checked into tech-news-frontend/public/knowledge_base.json.
- This strongly suggests the frontend consumes a static JSON artifact rather than calling a live backend API.
- In architecture terms, this file is the handoff boundary between ingestion and UI.
4. GitHub Actions automates refresh
- .github/workflows/update_data.yml indicates the dataset is periodically or automatically regenerated.
- This creates a simple pipeline: scheduled workflow → Python ingestion → updated JSON artifact → frontend-visible content.
- That workflow is likely the repo’s deployment/update mechanism for keeping news fresh.
5. Frontend is a client-side React app
- tech-news-frontend/ is a standard React application with src/, public/, package.json, and test files.
- It is responsible for rendering the news experience, not data collection.
- The app is likely bootstrapped via Create React App, given the file layout and index.js, reportWebVitals.js, and setupTests.js.
6. Data loading is isolated in a custom hook
- src/hooks/useNewsData.js is the key frontend data-access layer.
- This hook likely encapsulates loading/parsing of knowledge_base.json and exposes loading state plus news records to the UI.
- That keeps data-fetching concerns separate from the presentation components.
7. UI is composed of small presentation components
- The UI is split into reusable components: Header, Navigation, Hero, NewsGrid, NewsCard, Footer, and Loading.
- App.js likely composes these into the page layout, with NewsGrid and NewsCard forming the main content path.
- Loading suggests asynchronous data initialization before the news list renders.
8. Utilities support display formatting
- src/utils/helpers.js contains shared view logic or formatting helpers.
- This is probably where dates, titles, or text snippets are normalized before rendering.
- That utility boundary keeps the news cards and grid simple.
9. Static frontend assets live in public/
- public/knowledge_base.json, index.html, manifest.json, robots.txt, and styles.css indicate the frontend can be served as a static site.
- The presence of the JSON file in public/ means the browser can load it directly without a server-side API layer.
- This reinforces a static-content architecture rather than a request/response backend architecture.
10. External services are part of the ingestion side, not the UI
- The README references Hugging Face, Google Generative AI, and Pinecone.
- In this repo, those services are part of the news processing / RAG enrichment pipeline, not the frontend runtime.
- Architecturally, they sit behind the ingestion script as enrichment and storage dependencies.
11. Current code tree does not show a live backend service
- Although the README mentions Flask/FastAPI and HTTP/REST, there is no server app file in the tree.
- For diagramming, treat the backend as an offline or batch processing service that produces artifacts, unless other files outside this tree define an API.
- The runtime interaction visible here is primarily frontend reads JSON artifact.
12. End-to-end data flow
- External news sources feed the Python ingestion script.
- The script cleans, summarizes, and stores results in knowledge_base.json.
- GitHub Actions can refresh that artifact automatically.
- The React app loads the JSON and renders it through the hook/component layer.
13. What to put on an architecture diagram
- Draw three main boxes: News sources + AI enrichment, Python ingestion / knowledge base generation, and React frontend.
- Show knowledge_base.json as the shared artifact between ingestion and UI.
- Optionally show GitHub Actions as the automation trigger above ingestion.
Main entry points: App.js App shell · ingest_and_push.py Ingest script · NewsCard.js News card · knowledge_base.json KB artifact
Components 19
Automation
Scheduled dataset refresh and repository update flow.
- GitHub Actions · Scheduled refresh that runs the data-generation pipeline.
.github/workflows/update_data.yml
Ingestion
Python batch pipeline that gathers, enriches, and writes news data.
- Ingest script · Central offline pipeline entry point for collecting and preparing news records.
ingest_and_push.py - News sources · Upstream news feeds and content sources consumed by ingestion.
- AI services · External model and vector services used for extraction, summarization, and retrieval enrichment.
Knowledge base
Static JSON contract shared between ingestion and frontend.
- KB artifact · Repository-root knowledge base produced by ingestion.
knowledge_base.json - Public KB · Frontend-visible copy of the knowledge base served as a static asset.
tech-news-frontend/public/knowledge_base.json
React frontend
Client-side app that loads the knowledge base and renders the experience.
- News hook · Custom hook that loads and exposes news data to the UI.
tech-news-frontend/src/hooks/useNewsData.js - App shell · Top-level React composition for the news experience.
tech-news-frontend/src/App.js - Entry point · Frontend bootstrap that mounts the app.
tech-news-frontend/src/index.js - HTML shell · Static document that hosts the React app.
tech-news-frontend/public/index.html - Site styles · Static stylesheet used by the frontend shell.
tech-news-frontend/public/styles.css - Helpers · Shared display and text formatting helpers.
tech-news-frontend/src/utils/helpers.js
UI components
Presentation components used by the React app.
- Header · Top-level page header.
tech-news-frontend/src/components/Header.js - Navigation · Primary navigation for the page.
tech-news-frontend/src/components/Navigation.js - Hero · Intro banner or featured section.
tech-news-frontend/src/components/Hero.js - Loading · Loading state shown while news data initializes.
tech-news-frontend/src/components/Loading.js - News grid · Main collection view for the news feed.
tech-news-frontend/src/components/NewsGrid.js - News card · Individual news item presentation.
tech-news-frontend/src/components/NewsCard.js - Footer · Page footer and closing information.
tech-news-frontend/src/components/Footer.js
Connections 19
- GitHub Actions → Ingest script: runs · Workflow triggers the ingestion pipeline.
- News sources → Ingest script: inputs · External news feeds are collected by the pipeline.
- AI services → Ingest script: enriches · Model and retrieval services support extraction and summarization.
- Ingest script → KB artifact: writes · Pipeline persists the canonical knowledge base artifact.
- KB artifact → Public KB: syncs · The dataset is mirrored into the frontend public asset.
- Public KB → News hook: loads · The custom hook reads the static JSON artifact.
- News hook → App shell: provides data · Hook supplies news records and loading state to the app.
- App shell → Entry point: mounted by · React entry point bootstraps the app shell.
- HTML shell → Entry point: hosts · Static HTML shell hosts the React bundle.
- Site styles → HTML shell: styles · Static styles are applied to the frontend shell.
- App shell → Header: composes · App includes the header component.
- App shell → Navigation: composes · App includes the navigation component.
- App shell → Hero: composes · App includes the hero section.
- App shell → Loading: composes · App renders loading state during data initialization.
- App shell → News grid: composes · App renders the main news list.
- News grid → News card: renders · Grid maps records to individual cards.
- News card → Helpers: formats · Card display uses shared helper logic.
- App shell → Footer: composes · App includes the footer component.
- News card → Helpers: formats · Text and date presentation are normalized by helpers.