A modern news web app built with React, Vite, Tailwind CSS, and Vercel Serverless Functions to fetch real-time news from NewsAPI.
It delivers real-time headlines with a sleek UI, secure backend proxy, and optimized performance.
👉 Live Demo: https://news-aggregator-pi-pearl.vercel.app/
- Search for news with debounce 🚀
- Category filters (General, Tech, Sports, etc.)
- Client-side caching (localStorage)
- Serverless backend proxy to securely fetch news
- Light & Dark theme toggle 🌙☀️
- Add / Remove bookmarks ❤️
- Responsive UI with modern design
- Deployed via Vercel
| Technology | Purpose |
|---|---|
| React | UI Library |
| Vite | Development & Build Tool |
| Tailwind CSS | Utility-First Styling |
| Axios | HTTP Requests |
| Lucide Icons | SVG Icons |
| Vercel | Deployment & Serverless Functions |
| News-Aggregator │
├── api /
└── news.js # Serverless proxy │
├── src /
├── components /
│ ├── BookmarkButton.jsx
│ ├── CategoryFilter.jsx
│ ├── Error.jsx
│ ├── Loader.jsx
│ ├── Navbar.jsx
│ ├── NewsCard.jsx
│ └── SearchBar.jsx
├── App.jsx │
├── index.css │
├── main.jsx │
├── .env.example
├── .gitignore
└── package.jsongit clone https://github.com/mohdkamran-khan/News-Aggregator.git
cd News-Aggregatornpm installCreate a .env file in the project root with:
NEWS_API_KEY=YOUR_NEWSAPI_KEYnpm run devTo avoid exposing your NewsAPI key in the frontend, a serverless function is used.
The proxy file is located at:
/api/news.jsThis project is deployed on Vercel.
Steps to deploy:
-
Push the repo to GitHub
-
Go to https://vercel.com and import your project
-
Add environment variable:
NEWS_API_KEY=yourNewsAPIkey- Deploy
-
Search news using the top search bar
-
Select a category (All, Business, Tech, etc.)
-
Click the Bookmark button on a news card to save it
-
View bookmarks by clicking the bookmark icon in the navbar
-
Toggle light/dark theme
The app features:
-
Glassmorphism UI on search / filters
-
Modern responsive category chips
-
Smooth hover & transition effects
-
Clean and readable card layout
-
API keys are stored only on the serverless backend
-
No sensitive keys stored in frontend
-
.env files are ignored via .gitignore
- LocalStorage caching
- Debounced search
- Lightweight components
- Fast Vite builds
- Serverless architecture
Result → blazing fast UX.
-
NewsAPI free tier has restrictions on deployed domains; using proxy avoids this.
-
localStorage caching drastically improves performance.
Contributions are welcome. If you want to contribute:
- Fork the repo
- Create a feature branch
git checkout -b feature/your-feature - Commit your changes
git commit -m "feat: add ..." - Push and open a pull request
This project is open-source and available under the [MIT License]
Mohd Kamran Khan | You can reach me at: [mohdkamrankhan.dev@gmail.com]
🌐 Portfolio: mohdkamran-khan.github.io/KAMRAN-portfolio