A simple and responsive React-based News App that fetches top headlines and search results from the NewsAPI. Built for learning purposes, styled with Tailwind CSS, and deployed on GitHub Pages.
- Top headlines by category (General, Sports, Technology, etc.)
- Real-time search with
everythingendpoint - Responsive grid layout for news cards
- Fallback images for articles without thumbnails
- Smooth UX with loading states and error handling
- ⚛️ React + Vite
- 🎨 Tailwind CSS
- 📡 NewsAPI
git clone https://github.com/your-username/news-app.git
cd news-app
npm installCreate a .env file in the root of your project and add your NewsAPI key:
VITE_API_KEY=your_news_api_keyYou can get a free API key from: https://newsapi.org
npm run devThe app will be available at: http://localhost:5173
news-app/
├── public/
├── src/
│ ├── components/
│ │ ├── Navbar.jsx
│ │ ├── NewsBoard.jsx
│ │ └── NewsCard.jsx
│ ├── App.jsx
│ ├── main.jsx
│ └── index.css
├── .env
├── package.json
└── vite.config.jsTop Headlines:
https://newsapi.org/v2/top-headlines?category={category}&apiKey=YOUR_API_KEY
Search Everything:
https://newsapi.org/v2/everything?q={query}&apiKey=YOUR_API_KEY
This project is for educational purposes only. You are free to fork, modify, and use it for learning.