A modern, full-stack news aggregation platform with real-time weather forecasts and stock market data. Built with Next.js 16, TypeScript, and MongoDB.
Live Demo | Report Bug | Request Feature
- Real-time news from NewsAPI and New York Times
- Automatic daily updates via cron jobs
- Search and filter by source, keywords, or date
- 400+ articles daily across 6 categories:
- Business
- Technology
- World News
- Science
- Health
- Sports
- Real-time weather data from OpenWeatherMap
- 5-day forecast with hourly breakdowns
- Interactive visualizations using Recharts:
- Temperature bar charts
- Humidity line graphs
- Weather condition pie charts
- Location autocomplete with geocoding
- Geolocation support for automatic location detection
- Real-time stock prices via Market Data API
- Support for major stock symbols (AAPL, GOOGL, TSLA, etc.)
- Multi-currency conversion (USD, EUR, GBP, JPY, etc.)
- Clean, responsive card-based interface
- Cron jobs for automatic news ingestion (daily at midnight UTC)
- Database cleanup to maintain optimal performance (7-day retention)
- Smart deduplication to prevent duplicate articles
- Efficient MongoDB indexing for fast queries
Modern landing page with feature cards and smooth animations
Searchable news feed with category filtering
Interactive weather dashboard with data visualizations
- Next.js 16 (App Router, React Server Components)
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- Recharts - Data visualization library
- Next.js API Routes - Serverless functions
- MongoDB Atlas - Cloud database
- Mongoose - ODM for MongoDB
- NewsAPI - News headlines
- New York Times API - Premium news content
- OpenWeatherMap API - Weather data
- Market Data API - Stock market data
- Frankfurter API - Currency conversion
- BigDataCloud API - Geolocation
- Vercel - Deployment and hosting
- Vercel Cron Jobs - Scheduled tasks
- GitHub Actions - CI/CD (optional)
Before you begin, ensure you have:
- Node.js 18.x or higher
- npm or yarn
- MongoDB Atlas account (free tier works!)
- API keys for:
git clone https://github.com/Esstar612/newspaper.git
cd newspapernpm installCreate a .env.local file in the root directory:
# MongoDB
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/newspaper
# News APIs
NEWS_API_KEY=your_newsapi_key
NYT_API_KEY=your_nyt_api_key
# Weather API
OPENWEATHER_API_KEY=your_openweather_key
# Stock Market API
MARKET_DATA_API_KEY=your_market_data_key
# Cron Security (optional but recommended)
CRON_SECRET=your_secret_key_herenpm run devOpen http://localhost:3000 in your browser.
npm run build
npm start{
title: String, // Article headline
description: String, // Article summary
url: String, // Article URL (unique)
imageUrl: String, // Featured image
source: String, // News source (NYT, NewsAPI, etc.)
publishedAt: Date, // Publication date
providerId: String, // Source-specific ID
createdAt: Date, // Auto-generated
updatedAt: Date // Auto-generated
}url: Unique index for deduplicationpublishedAt: Sorted queriessource + publishedAt: Filtered sorted queries
The app uses Vercel Cron Jobs to automate data management:
// Fetches from multiple sources
- NewsAPI: 100 articles
- NYT Business: 50 articles
- NYT Technology: 50 articles
- NYT World: 50 articles
- NYT Science: 50 articles
- NYT Health: 50 articles
- NYT Sports: 50 articles
// Total: ~400 articles/day// Maintains optimal database size
- Removes articles older than 7 days
- Keeps ~14,000 articles max
- Database size: ~14 MBAll APIs are used within free tier limits:
| API | Daily Usage | Free Limit | % Used |
|---|---|---|---|
| NewsAPI | 1 call | 100 calls | 1% |
| NYT API | 6 calls | 500 calls | 1.2% |
| OpenWeatherMap | On-demand | 1,000 calls | Variable |
| Market Data | On-demand | 100 calls | Variable |
Total Cost: $0/month ๐
- Search: Full-text search across titles and descriptions
- Filters: Filter by news source (NewsAPI, NYT, etc.)
- Pagination: Cursor-based pagination for infinite scroll
- Responsive Cards: Beautiful article cards with images
- External Links: Direct links to original articles
- Current Weather: Temperature, conditions, humidity
- 5-Day Forecast: Detailed hourly predictions
- Location Search: Autocomplete city search
- Geolocation: Automatic location detection
- Visualizations:
- Temperature trends (bar chart)
- Humidity patterns (line chart)
- Weather distribution (pie chart)
- Real-Time Prices: Live stock market data
- Currency Conversion: Convert to 30+ currencies
- Popular Stocks: Quick access to major symbols
- Clean UI: Simple, readable design
-
Fork this repository
-
Import to Vercel
- Go to vercel.com/new
- Import your forked repository
- Vercel will auto-detect Next.js
- Add Environment Variables
- Go to Project Settings โ Environment Variables
- Add all keys from
.env.local
- Deploy
- Click "Deploy"
- Your app will be live in ~2 minutes!
- Verify Cron Jobs
- Go to Project Settings โ Crons
- You should see 2 cron jobs listed
- Go to Project Settings โ Domains
- Add your custom domain
- Configure DNS records as instructed
npm test# Test news ingestion
curl http://localhost:3000/api/cron/ingest-news
# Test weather API
curl http://localhost:3000/api/weather?q=London
# Test stock API
curl http://localhost:3000/api/stocks/AAPLnewspaper/
โโโ app/
โ โโโ api/
โ โ โโโ admin/
โ โ โ โโโ ingest-news/ # Manual news ingestion
โ โ โโโ cron/
โ โ โ โโโ ingest-news/ # Automated news fetch
โ โ โ โโโ cleanup-old-news/ # Database cleanup
โ โ โโโ forecast/ # Weather forecast
โ โ โโโ geocoding/ # Location search
โ โ โโโ news/ # News feed API
โ โ โโโ stocks/[symbol]/ # Stock data
โ โ โโโ weather/ # Current weather
โ โโโ news/ # News page
โ โโโ stocks/ # Stocks page
โ โโโ weather/ # Weather page
โ โโโ page.tsx # Landing page
โโโ components/
โ โโโ ArticleCard.tsx # News article card
โ โโโ Header.tsx # Navigation header
โ โโโ TemperatureBarGraph.tsx # Weather chart
โ โโโ HumidityLineGraph.tsx # Weather chart
โ โโโ WeatherPieChart.tsx # Weather chart
โโโ lib/
โ โโโ db.ts # MongoDB connection
โโโ models/
โ โโโ Article.ts # Article schema
โโโ public/ # Static assets
โโโ vercel.json # Cron configuration
โโโ .env.local # Environment variables (not committed)
โโโ package.json
Contributions are what make the open-source community amazing! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Weather timing precision limited on Vercel Hobby plan (ยฑ59 minutes)
- News API free tier limited to 100 requests/day
- Stock data may have slight delays (free tier limitation)
See open issues for a full list of known issues.
- User authentication and personalization
- Bookmarking and reading lists
- Email notifications for breaking news
- Mobile app (React Native)
- Dark/light theme toggle
- Advanced search filters
- Social sharing features
- RSS feed generation
- Multi-language support
Distributed under the MIT License. See LICENSE for more information.
Star Olaojo
- GitHub: @Esstar612
- LinkedIn: Star Olaojo
- Portfolio: https://esstar612.github.io/my_portfolio/
- Next.js Documentation
- Vercel Platform
- NewsAPI
- New York Times Developer Network
- OpenWeatherMap
- Recharts
- Tailwind CSS
Give a โญ๏ธ if this project helped you!
Project Link: https://github.com/Esstar612/newspaper
Live Demo: https://newspaper-kohl.vercel.app