Skip to content

Maher-Elmair/Headline-News

Repository files navigation

News Icon Headline News

Your premier destination for quality journalism, breaking news, and in-depth stories β€” powered by real-time APIs.

React 19 TypeScript Vite Tailwind CSS Shadcn UI React Query

πŸ“Œ Table of Contents


✨ Overview

Headline is a modern, API-driven news aggregation platform that combines journalistic excellence with cutting-edge web technology. All articles are dynamically fetched from trusted third-party APIs, ensuring content is always fresh, diverse, and accurate.

Key highlights:

  • 🌍 Global coverage β€” news from thousands of sources via NewsData.io
  • πŸ“ˆ Market data β€” real-time financial news powered by Finnhub
  • πŸ€– AI-enhanced reading β€” clean article extraction via Jina AI Reader
  • 🎨 Premium UX β€” dark/light themes, customizable reading settings, skeleton loaders
  • πŸ” Privacy-first β€” fully client-side, no user data collected or stored

Disclaimer: Headline operates as a demonstration news platform. All articles and content are fetched from third-party APIs to illustrate the platform's capabilities. We do not claim ownership or editorial control over the displayed content.


πŸ–ΌοΈ Screenshots

πŸŒ™ Home β€” Dark β˜€οΈ Home β€” Light ⏳ Skeleton β€” Dark ⏳ Skeleton β€” Light

Dark mode home page

Light mode home page

Loading state β€” dark

Loading state β€” light

πŸ“° Article Reader ⚠️ Article Error πŸ” Search πŸ”Ž Search Results

Full article reader

Graceful load error

Search interface

Live search results

πŸ—‚οΈ All Categories πŸ“ Category Feed πŸ”₯ Trending ℹ️ About / Privacy

Browse all categories

Articles by category

Trending stories

About & Privacy pages

πŸ› οΈ Tech Stack

Category Tools & Libraries
Core Framework React 19.2.0, TypeScript 5.9.3, Vite 7.3.1
Styling Tailwind CSS 4.1.18, shadcn/ui, Radix UI Primitives
Data Fetching TanStack React Query 5.90
Routing React Router 7.13
Animations Motion 12.34
Content Parsing @mozilla/readability, DOMPurify, react-markdown
HTTP Client Axios 1.13
UI & Components Lucide React Icons, Embla Carousel, Sonner Toasts
Theming next-themes
Dev Tooling ESLint 9, TypeScript ESLint, Vite HMR

🌐 API Integrations

API Usage Docs
NewsData.io Global news from thousands of sources, with multi-key rotation support newsdata.io/documentation
Finnhub Real-time financial market data and business news finnhub.io/docs
Jina AI Reader AI-powered content extraction for clean, readable article text jina.ai/reader

πŸ“ Project Structure

src/
β”‚
β”œβ”€β”€ api/                          # External API clients
β”‚   β”œβ”€β”€ market/
β”‚   β”‚   β”œβ”€β”€ finnhubApi.ts         # Finnhub market data fetcher
β”‚   β”‚   └── index.ts
β”‚   β”œβ”€β”€ news/
β”‚   β”‚   β”œβ”€β”€ apiKeyManager.ts      # Rotating API key manager (multi-key support)
β”‚   β”‚   β”œβ”€β”€ newsApi.ts            # NewsData.io fetcher
β”‚   β”‚   └── index.ts
β”‚   └── index.ts
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ shared/                   # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ ArticleCard.tsx       # News card component
β”‚   β”‚   β”œβ”€β”€ CategoriesBar.tsx     # Top categories navigation bar
β”‚   β”‚   β”œβ”€β”€ EmptyState.tsx        # Empty / no-results state
β”‚   β”‚   β”œβ”€β”€ Footer.tsx
β”‚   β”‚   β”œβ”€β”€ ImageWithFallback.tsx # Image with error fallback
β”‚   β”‚   β”œβ”€β”€ Loader.tsx            # Spinner loader
β”‚   β”‚   β”œβ”€β”€ LoadingState.tsx      # Skeleton loading layout
β”‚   β”‚   β”œβ”€β”€ LogoIcon.tsx
β”‚   β”‚   β”œβ”€β”€ ModernBreakingNews.tsx # Animated breaking news ticker
β”‚   β”‚   β”œβ”€β”€ ModernHeader.tsx      # Top navigation header
β”‚   β”‚   β”œβ”€β”€ NavigationDrawer.tsx  # Mobile sidebar drawer
β”‚   β”‚   β”œβ”€β”€ NewsList.tsx          # Article list renderer
β”‚   β”‚   β”œβ”€β”€ ScrollToTop.tsx       # Floating scroll-to-top button
β”‚   β”‚   β”œβ”€β”€ SmartSearch.tsx       # Live search with suggestions
β”‚   β”‚   └── TrendingList.tsx      # Trending articles list
β”‚   └── ui/                       # shadcn/ui primitives
β”‚       └── button.tsx
β”‚
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ article/                  # Article page features
β”‚   β”‚   β”œβ”€β”€ ColorPicker.tsx       # Reading background color selector
β”‚   β”‚   β”œβ”€β”€ ReadingProgressBar.tsx # Scroll progress indicator
β”‚   β”‚   β”œβ”€β”€ ReadingSettingsPanel.tsx # Font, size & layout settings
β”‚   β”‚   └── ShareButtons.tsx      # Social share + copy link buttons
β”‚   └── home/                     # Home page sections
β”‚       β”œβ”€β”€ CategoryShowcase.tsx
β”‚       β”œβ”€β”€ CompactMarketWatch.tsx # Mini market ticker strip
β”‚       β”œβ”€β”€ EliteCategorySection.tsx
β”‚       β”œβ”€β”€ FeaturedCarousel.tsx  # Hero news carousel
β”‚       └── LatestNewsSection.tsx
β”‚
β”œβ”€β”€ hooks/                        # Custom React hooks
β”‚   β”œβ”€β”€ useCategoryArticleCounts.ts
β”‚   β”œβ”€β”€ useJinaContent.ts         # Fetch & parse article via Jina
β”‚   β”œβ”€β”€ usePageLoading.ts
β”‚   β”œβ”€β”€ useReadingSettings.ts     # Persist reading preferences
β”‚   β”œβ”€β”€ useUserCity.ts            # Detect user location
β”‚   └── index.ts
β”‚
β”œβ”€β”€ layouts/
β”‚   └── RootLayout.tsx            # App shell with header & footer
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ query/                    # TanStack Query configuration
β”‚   β”‚   β”œβ”€β”€ market/               # Market query hooks & constants
β”‚   β”‚   β”œβ”€β”€ news/                 # News query hooks, keys, filters
β”‚   β”‚   β”œβ”€β”€ queryClient.ts
β”‚   β”‚   └── QueryProvider.tsx
β”‚   β”œβ”€β”€ theme/                    # Theme context & provider
β”‚   β”œβ”€β”€ categories-data.ts        # Static category definitions
β”‚   β”œβ”€β”€ dateUtils.ts
β”‚   β”œβ”€β”€ localCache.ts             # localStorage caching helpers
β”‚   β”œβ”€β”€ mock-data.ts
β”‚   β”œβ”€β”€ reading-settings.ts
β”‚   β”œβ”€β”€ reading-settings-context.tsx
β”‚   └── utils.ts
β”‚
β”œβ”€β”€ pages/                        # Route-level page components
β”‚   β”œβ”€β”€ AboutPage.tsx
β”‚   β”œβ”€β”€ ArticlePage.tsx
β”‚   β”œβ”€β”€ CategoriesPage.tsx
β”‚   β”œβ”€β”€ CategoryPage.tsx
β”‚   β”œβ”€β”€ HomePage.tsx
β”‚   β”œβ”€β”€ NotFoundPage.tsx          # 404 page
β”‚   β”œβ”€β”€ PrivacyPage.tsx
β”‚   β”œβ”€β”€ SearchPage.tsx
β”‚   β”œβ”€β”€ TrendingPage.tsx
β”‚   └── index.ts
β”‚
β”œβ”€β”€ routes/
β”‚   └── index.ts                  # Centralized route definitions
β”‚
β”œβ”€β”€ services/
β”‚   └── articleExtractor.ts       # Jina Reader extraction service
β”‚
β”œβ”€β”€ styles/
β”‚   β”œβ”€β”€ fonts.css
β”‚   └── globals.css
β”‚
β”œβ”€β”€ types/                        # Shared TypeScript types
β”‚   β”œβ”€β”€ article.ts
β”‚   β”œβ”€β”€ market.ts
β”‚   β”œβ”€β”€ news.ts
β”‚   └── index.ts
β”‚
β”œβ”€β”€ utils/
β”‚   └── variants.ts               # CVA class variant utilities
β”‚
β”œβ”€β”€ App.tsx                       # Root component & router setup
β”œβ”€β”€ main.tsx                      # App entry point
└── vite-env.d.ts

🎯 Core Features

πŸ“° News & Content

  • Real-time articles fetched from multiple news APIs
  • Breaking news ticker with smooth animated scroll
  • Featured hero carousel showcasing top stories
  • Category filtering β€” browse articles by topic
  • Trending stories β€” discover what's popular right now
  • Smart search with live suggestions

πŸ“– Article Reading Experience

  • AI-powered content extraction via Jina Reader for clean, distraction-free reading
  • Reading progress bar that tracks your scroll position through the article
  • Customizable reading panel β€” adjust font size, background color, and layout; all preferences are saved to localStorage
  • Share buttons β€” Facebook, Twitter, LinkedIn, and Copy Link
  • Graceful error fallback when an article cannot be extracted

πŸ“Š Market Watch

  • Compact market ticker on the home page with live stock and financial data powered by Finnhub

🎨 UI & UX

  • Dark / Light mode with persistent user preference
  • Skeleton loading states for smooth perceived performance
  • Fully responsive β€” optimized for mobile, tablet, and desktop
  • Mobile navigation drawer for smaller screens
  • Scroll-to-top floating button
  • Custom 404 page

πŸ”‘ Smart API Management

  • Built-in rotating API key manager β€” cycles through up to 3 NewsData.io keys automatically to prevent rate limiting

πŸš€ Getting Started

Installation

# Clone the repository
git clone https://github.com/your-username/Headline-News.git
cd Headline-News

# Install dependencies
npm install

Environment Variables

Create a .env.local file in the root directory and fill in your API keys:

# ─── Finnhub ────────────────────────────────────────────────
# Get your free key at: https://finnhub.io
VITE_FINNHUB_API_KEY=""

# ─── NewsData.io ─────────────────────────────────────────────
# Get your free key at: https://newsdata.io
# Add 1 up to 5 keys β€” the app rotates between them automatically to avoid hitting rate limits
VITE_NEWSDATA_API_KEY_1="pub_"
VITE_NEWSDATA_API_KEY_2="pub_"
VITE_NEWSDATA_API_KEY_3="pub_"

# ─── Jina AI Reader ──────────────────────────────────────────
# Get your free key at: https://jina.ai/reader
VITE_JINA_READER_API_KEY="jina_"

Running the Project

# Start development server
npm run dev

# Type-check and build for production
npm run build

# Preview production build
npm run preview

# Lint the codebase
npm run lint

πŸ”’ Privacy & Data

Headline is a client-side only application. It does not:

  • Collect personal information
  • Use tracking cookies or analytics
  • Store any data on external servers

The only data stored locally is your theme preference and reading settings, saved in your browser's localStorage. This data never leaves your device.

All news content is fetched in real time from third-party APIs and is displayed "as is." Headline does not independently verify, endorse, or take responsibility for the accuracy of any displayed content.


πŸ“ˆ Roadmap

Status Feature
βœ… Done Core news aggregation platform
βœ… Done Dark/Light theme
βœ… Done Customizable reading experience
βœ… Done Market watch ticker
βœ… Done AI-powered article extraction
πŸ”„ Planned Dedicated stocks/market page
πŸ”„ Planned Backend server for saving & bookmarking articles
πŸ”„ Planned Functional article view count & engagement metrics
πŸ”„ Planned Working social media share links per article
πŸ”„ Planned Additional UI & performance improvements

πŸ‘¨β€πŸ’» Developer

Maher Elmair


πŸ”— Live Preview

πŸš€ Try it now on Vercel:


πŸ™Œ Thank You

If you found this project useful or inspiring, please consider giving it a ⭐️
Pull requests, issues, and suggestions are always welcome πŸ™


Headline β€” Where quality journalism meets real-time technology

About

A modern API-driven news aggregation platform. Features real-time news, AI-powered article extraction, market watch, dark/light theme, and customizable reading experience.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages