Headlinr is a full-stack news summary app with a React + Vite frontend and a FastAPI backend.
The backend fetches news data from newsdata.io, sends it through a LangChain agent using the ChatGroq model, and returns a simple JSON response:
{
"query": "example query",
"summary": ["summary1", "summary2", "summary3"]
}The frontend sends user search queries to the backend and renders the returned summary items in an animated news card layout.
backend/requirements.txt- Python dependencies for the backendsrc/main.py- FastAPI application and route definitionssrc/services/headlinr_service.py- News fetching and LangChain agent logic
frontend/package.json- Frontend dependencies and scriptssrc/- React application source filessrc/components/- UI components such asNavbar,NewsCard,NewsList, andSearchBar
-
Open a terminal in
backend/. -
Create and activate a virtual environment (recommended):
python -m venv .venv .\.venv\Scripts\Activate.ps1 -
Install dependencies:
pip install -r requirements.txt -
Create a
.envfile inbackend/with your News API key:NEWS_API_KEY=your_newsdata_api_key_here
-
Run the backend:
uvicorn src.main:app --reload --host 127.0.0.1 --port 8000
GET /- health check endpointPOST /get_news- accepts a JSON body with aqueryfield and returns summarized news results
Example request body:
{
"query": "AI news"
}-
Open a terminal in
frontend/. -
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open the URL shown in the terminal, usually
http://localhost:5173.
- The frontend sends the user search query to the backend at
http://127.0.0.1:8000/get_news. - The backend fetches top news articles from the
newsdata.ioAPI. - A LangChain agent uses the
ChatGroqmodel to format a clean JSON summary response. - The frontend displays each string from the
summaryarray in a styled animated card.
- Make sure the backend and frontend are both running at the same time.
- The frontend is configured to allow CORS requests from
http://localhost:5173. - If you change the backend host or port, update the fetch URL in
frontend/src/App.jsx.
- Add real article links and richer card content.
- Add loading/error states from the backend response.
- Add query history or saved searches.
- Add unit tests for backend and frontend components.