A modern, full-stack news aggregation and summarization platform built with React, TypeScript, Node.js, and Redis. NewsHub provides users with AI-powered news summaries, personalized feeds, and advanced search capabilities using Google Gemini AI and Redis vector search.
- AI-Powered News Summarization: Uses Google Gemini AI for intelligent content analysis
- Vector Search & Similarity: Redis-based semantic search with embeddings
- Personalized News Feeds: User preference-based content recommendations
- Real-time News Fetching: Automated news collection from multiple sources
- Advanced Search: Filter articles by topic, sentiment, source, and keywords
- Responsive Design: Optimized for desktop, tablet, and mobile devices
- Infinite Scroll: Seamless browsing with automatic content loading
- Article Analytics: View engagement metrics and trending articles
- Sentiment Analysis: Visual indicators for article sentiment (positive, negative, neutral)
- Topic Filtering: Browse news by categories and interests
- Real-time Updates: Stay informed with the latest news from multiple sources
- TypeScript: Full type safety and better development experience
- React Query: Efficient data fetching and caching
- React Router: Client-side routing with smooth navigation
- Tailwind CSS: Utility-first styling with custom components
- Shadcn/ui: Beautiful, accessible UI components
- Redis 8+: Advanced caching, vector search, and JSON storage
- Express.js: High-performance REST API
- Vite: Fast development and build tooling
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Frontend โ โ Backend โ โ External โ
โ (React/TS) โโโโโบโ (Node.js) โโโโโบโ Services โ
โ โ โ โ โ โ
โ โข React Router โ โ โข Express.js โ โ โข NewsAPI.org โ
โ โข React Query โ โ โข Redis Client โ โ โข Google Gemini โ
โ โข Shadcn/ui โ โ โข AI Services โ โ โข Redis Cloud โ
โ โข Tailwind CSS โ โ โข Cache Layer โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ User Layer โ โ Data Layer โ โ AI Layer โ
โ โ โ โ โ โ
โ โข User Interfaceโ โ โข Redis JSON โ โ โข Content โ
โ โข Personalizationโ โ โข Vector Search โ โ Analysis โ
โ โข Search/Filter โ โ โข Multi-layer โ โ โข Sentiment โ
โ โข Responsive UI โ โ Caching โ โ Analysis โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ NewsAPI.org โโโโโบโ News โโโโโบโ AI โโโโโบโ Redis โ
โ โ โ Processor โ โ Processor โ โ Storage โ
โ โข Raw News โ โ โข Fetch โ โ โข Gemini โ โ โข JSON โ
โ โข Metadata โ โ โข Parse โ โ โข Embeddingsโ โ โข Vectors โ
โ โข Sources โ โ โข Validate โ โ โข Sentiment โ โ โข Indexes โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ Frontend โโโโโโ API Layer โโโโโโ Cache Layer โโโโโโ Search โ
โ โ โ โ โ โ โ Engine โ
โ โข React App โ โ โข Express โ โ โข Multi- โ โ โข Vector โ
โ โข Componentsโ โ โข Routes โ โ layer โ โ Search โ
โ โข State Mgmtโ โ โข Controllersโ โ โข LRU Cache โ โ โข Full-text โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Frontend Layer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Pages Layer โ
โ โโโ Home.tsx (News Feed) โ
โ โโโ Search.tsx (Advanced Search) โ
โ โโโ Trending.tsx (Trending Articles) โ
โ โโโ PersonalizedFeed.tsx (User Preferences) โ
โ โโโ Article.tsx (Article Details) โ
โ โโโ NotFound.tsx (404 Page) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Components Layer โ
โ โโโ UI Components (Shadcn/ui) โ
โ โ โโโ Cards, Buttons, Forms โ
โ โ โโโ Navigation, Modals โ
โ โ โโโ Charts, Notifications โ
โ โโโ Custom Components โ
โ โ โโโ ArticleCard.tsx โ
โ โ โโโ SearchFilters.tsx โ
โ โ โโโ Header.tsx โ
โ โ โโโ SentimentBadge.tsx โ
โ โโโ Layout Components โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Hooks Layer โ
โ โโโ useDebounce.ts (Search Optimization) โ
โ โโโ use-mobile.tsx (Responsive Logic) โ
โ โโโ use-toast.ts (Notifications) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Services Layer โ
โ โโโ api.ts (API Client) โ
โ โโโ userManager.ts (User Management) โ
โ โโโ config.ts (Configuration) โ
โ โโโ utils.ts (Utilities) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend Layer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ API Layer (Express.js) โ
โ โโโ Routes โ
โ โ โโโ /api/news (News Management) โ
โ โ โโโ /api/user (User Management) โ
โ โ โโโ /api/metadata (Metadata) โ
โ โ โโโ /api/admin (Admin Functions) โ
โ โ โโโ /api/health (Health Checks) โ
โ โโโ Controllers โ
โ โ โโโ newsController.js (Request Handlers) โ
โ โโโ Middleware โ
โ โโโ errorHandler.js (Error Handling) โ
โ โโโ logger.js (Logging) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Services Layer โ
โ โโโ redisService.js (Database Operations) โ
โ โโโ geminiService.js (AI Integration) โ
โ โโโ newsProcessor.js (Content Processing) โ
โ โโโ newsFetcherService.js (External API) โ
โ โโโ cacheClearService.js (Cache Management) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Data Layer (Redis) โ
โ โโโ JSON Storage (Article Data) โ
โ โโโ Vector Search (Semantic Similarity) โ
โ โโโ Hash Storage (User Preferences) โ
โ โโโ Sorted Sets (Trending Metrics) โ
โ โโโ Multi-layer Caching โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Content โ โ AI Processing โ โ Vector โ
โ Input โโโโโบโ Pipeline โโโโโบโ Storage โ
โ โ โ โ โ โ
โ โข News Articles โ โ โข Gemini 2.0 โ โ โข Embeddings โ
โ โข Raw Text โ โ โข Summarization โ โ โข Similarity โ
โ โข Metadata โ โ โข Sentiment โ โ โข Search Index โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Content โ โ AI Services โ โ Search โ
โ Analysis โ โ โ โ Results โ
โ โ โ โข Text Analysis โ โ โ
โ โข Keywords โ โ โข Entity โ โ โข Semantic โ
โ โข Topics โ โ Extraction โ โ Search โ
โ โข Categories โ โ โข Classificationโ โ โข Recommendationsโ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Request โ โ Cache Layer โ โ Data Source โ
โ Layer โโโโโบโ โโโโโบโ โ
โ โ โ โ โ โ
โ โข API Requests โ โ โข Request Cache โ โ โข Redis JSON โ
โ โข User Queries โ โ โข Query Cache โ โ โข Vector DB โ
โ โข Search Filtersโ โ โข Result Cache โ โ โข External APIs โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โฒ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโ Cache โโโโโโโโโโโโโโโโ
โ Statistics โ
โ โ
โ โข Hit/Miss โ
โ โข Performance โ
โ โข Eviction โ
โโโโโโโโโโโโโโโโโโโ
- Framework: React 18 with TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS + Shadcn/ui components
- State Management: React Query (TanStack Query)
- Routing: React Router DOM
- UI Components: Radix UI primitives
- Icons: Lucide React
- Date Handling: date-fns
- Form Handling: React Hook Form + Zod validation
- Charts: Recharts
- Notifications: Sonner toast
- Runtime: Node.js with Express.js
- Database: Redis 8+ (JSON, Vector Search, Caching)
- AI Services: Google Gemini AI (Gemini 2.0 Flash, Embeddings)
- News API: NewsAPI.org integration
- Caching: Multi-layer Redis caching system
- Search: Redis Search with vector similarity
- Scheduling: Node-cron for automated tasks
newshub/
โโโ backend/ # Node.js backend (NewsHub API)
โ โโโ src/
โ โ โโโ controllers/ # Request handlers
โ โ โ โโโ newsController.js
โ โ โโโ routes/ # API route definitions
โ โ โ โโโ adminRoutes.js
โ โ โ โโโ healthRoutes.js
โ โ โ โโโ metadataRoutes.js
โ โ โ โโโ newsRoutes.js
โ โ โ โโโ userRoutes.js
โ โ โโโ services/ # Business logic
โ โ โ โโโ cacheClearService.js
โ โ โ โโโ geminiService.js
โ โ โ โโโ newsFetcherService.js
โ โ โ โโโ newsProcessor.js
โ โ โ โโโ redisService.js
โ โ โโโ middleware/ # Express middleware
โ โ โ โโโ errorHandler.js
โ โ โ โโโ logger.js
โ โ โโโ utils/ # Utility functions
โ โ โ โโโ pagination.js
โ โ โโโ config/ # Configuration
โ โ โ โโโ database.js
โ โ โโโ scripts/ # Management scripts
โ โ โ โโโ clearAllCache.js
โ โ โ โโโ clearCache.js
โ โ โ โโโ clearCacheExceptUser.js
โ โ โ โโโ clearNews.js
โ โ โ โโโ deleteSearchIndex.js
โ โ โโโ app.js # Express application
โ โโโ scripts/ # Root-level scripts
โ โ โโโ run-news-processor.js
โ โโโ docs/ # Documentation
โ โ โโโ CACHE_CLEARING.md
โ โ โโโ CACHE_MANAGEMENT.md
โ โ โโโ README.md
โ โโโ logs/ # Application logs
โ โโโ index.js # Entry point
โ โโโ addNews.js # News addition utility
โ โโโ test-cors.js # CORS testing utility
โ โโโ package.json
โ โโโ package-lock.json
โ โโโ vercel.json # Vercel deployment config
โ โโโ cache_clear_metrics_1754132194592.json
โ โโโ README.md
โโโ frontend/ # React frontend (NewsHub Web App)
โ โโโ src/
โ โ โโโ components/ # UI components
โ โ โ โโโ ui/ # Shadcn/ui components
โ โ โ โโโ ArticleCard.tsx
โ โ โ โโโ Header.tsx
โ โ โ โโโ LoadingSpinner.tsx
โ โ โ โโโ PersonalizedSearchFilters.tsx
โ โ โ โโโ PreferenceSetup.tsx
โ โ โ โโโ SearchFilters.tsx
โ โ โ โโโ SentimentBadge.tsx
โ โ โโโ pages/ # Page components
โ โ โ โโโ Article.tsx
โ โ โ โโโ Home.tsx
โ โ โ โโโ Index.tsx
โ โ โ โโโ NotFound.tsx
โ โ โ โโโ PersonalizedFeed.tsx
โ โ โ โโโ Search.tsx
โ โ โ โโโ Trending.tsx
โ โ โโโ hooks/ # Custom React hooks
โ โ โ โโโ useDebounce.ts
โ โ โ โโโ use-mobile.tsx
โ โ โ โโโ use-toast.ts
โ โ โโโ lib/ # Utility libraries
โ โ โ โโโ api.ts
โ โ โ โโโ config.ts
โ โ โ โโโ env.ts
โ โ โ โโโ userManager.ts
โ โ โ โโโ utils.ts
โ โ โโโ App.tsx # Main React component
โ โ โโโ main.tsx # Application entry point
โ โ โโโ index.css # Global styles
โ โ โโโ App.css # App-specific styles
โ โโโ public/ # Static assets
โ โ โโโ favicon.ico
โ โ โโโ placeholder.svg
โ โ โโโ robots.txt
โ โโโ .gitignore
โ โโโ bun.lockb # Bun lock file
โ โโโ components.json # Shadcn/ui configuration
โ โโโ env.example # Environment variables template
โ โโโ eslint.config.js # ESLint configuration
โ โโโ index.html # HTML template
โ โโโ package.json # Dependencies and scripts
โ โโโ package-lock.json
โ โโโ postcss.config.js # PostCSS configuration
โ โโโ tailwind.config.ts # Tailwind configuration
โ โโโ tsconfig.json # TypeScript configuration
โ โโโ tsconfig.app.json
โ โโโ tsconfig.node.json
โ โโโ vercel.json # Vercel deployment config
โ โโโ vite.config.ts # Vite configuration
โ โโโ vite.config.ts.timestamp-1753710958480-1ca4a5f8d9d6c.mjs
โโโ README.md # This file
Note: The frontend is now fully developed with a complete React TypeScript application including:
- Comprehensive UI components with Shadcn/ui
- Multiple pages for different features (Home, Search, Trending, Personalized Feed, etc.)
- Custom hooks for functionality like debouncing and mobile detection
- API integration and user management
- Responsive design with Tailwind CSS
- Node.js 18+
- Redis 8+ (with RedisJSON and RedisSearch modules)
- Google Gemini API key
- NewsAPI.org API key
-
Clone the repository
git clone <repository-url> cd newshub
-
Backend Setup
cd backend npm install # Create .env file echo "REDIS_URL=redis://localhost:6379 GEMINI_API_KEY=your_gemini_api_key NEWSAPI_KEY=your_newsapi_key PORT=3001 NODE_ENV=development" > .env # Start the server npm run dev
-
Frontend Setup
cd ../frontend npm install # Create environment file (optional - will use fallback if not created) cp env.example .env # Start development server npm run dev
-
Access the Application
- Frontend: http://localhost:8080
- Backend API: http://localhost:3001
# Redis Configuration
REDIS_URL=redis://localhost:6379
# AI Services
GEMINI_API_KEY=your_gemini_api_key
# News API
NEWSAPI_KEY=your_newsapi_key
# Server Configuration
PORT=3001
NODE_ENV=developmentThe frontend uses environment variables for configuration. Create a .env file in the frontend directory:
# API Configuration
VITE_API_BASE_URL=http://localhost:3001
# Feature Flags
VITE_ENABLE_ANALYTICS=false
VITE_DEBUG_MODE=falseThe API base URL is automatically configured with fallback to http://localhost:3001 if not specified.
- Redis 8+ with RedisJSON module
- RedisSearch module for vector search
- Minimum 1GB memory recommended
The backend is configured to accept requests from:
- Local development:
http://localhost:8080,http://localhost:3000,http://localhost:5173 - Production:
https://newshub-henna.vercel.appand other Vercel domains - Custom domains can be added to the CORS configuration in
src/app.js
GET /api/news- Get all articles with paginationGET /api/news/:id- Get specific article by IDGET /api/news/:id/similar- Get similar articlesGET /api/news/:id/metrics- Get article engagement metricsGET /api/news/search- Search articles with filtersGET /api/news/topic/:topic- Get articles by topicGET /api/news/sentiment/:sentiment- Get articles by sentimentGET /api/news/trending- Get trending articles
POST /api/user/generate-id- Generate unique user IDPOST /api/user/:userId/preferences- Store user preferencesGET /api/user/:userId/preferences- Get user preferencesPUT /api/user/:userId/preferences- Update user preferencesGET /api/user/:userId/personalized-news- Get personalized feedGET /api/user/:userId/personalized-news/search- Search personalized contentGET /api/user/:userId/history- Get user reading history
GET /api/metadata/topics- Get available topicsGET /api/metadata/sentiments- Get sentiment optionsGET /api/metadata/sources- Get news sources
GET /api/admin/similar-stats/:id- Get similarity statisticsGET /api/admin/clear-similar-cache/:id- Clear similarity cacheGET /api/health- Health check endpoint
- JSON Storage: Article data with full-text search
- Vector Search: Semantic similarity with embeddings
- Hash Storage: User preferences and metadata
- Sorted Sets: Trending articles and metrics
- Multi-layer Caching: Request, query, and result caching
- LRU Eviction: Intelligent cache management
- Bloom Filters: Efficient duplicate detection
- Cache Statistics: Performance monitoring
- Full-text Search: Article content and metadata
- Vector Similarity: Semantic article matching
- Faceted Search: Topic, sentiment, source filtering
- Fuzzy Matching: Typo-tolerant search
- Content Summarization: Intelligent article summarization
- Sentiment Analysis: Positive, negative, neutral classification
- Keyword Extraction: Relevant topic and entity extraction
- Vector Embeddings: Semantic similarity generation
- Fetch: Collect news from multiple sources
- Analyze: AI-powered content analysis
- Store: Redis storage with search indexing
- Cache: Multi-layer caching for performance
- Serve: RESTful API delivery
# Development
npm run dev # Start development server
npm start # Start production server
# Cache Management
npm run cache:stats # Show cache statistics
npm run cache:clear # Clear cache (with confirmation)
npm run cache:force # Force clear cache
npm run cache:nuclear # Clear all Redis data
npm run cache:complete-stats # Detailed Redis statistics
npm run cache:help # Show cache management help# Development
npm run dev # Start development server
npm run build # Build for production
npm run build:dev # Build for development
npm run preview # Preview production build
npm run lint # Run ESLintThe application uses a comprehensive set of UI components built with Shadcn/ui and Radix UI:
- Cards: Article display and information containers
- Buttons: Various button styles and states
- Badges: Topic and sentiment indicators
- Forms: Search filters and user preferences
- Navigation: Header and mobile menu
- Loading States: Spinners and skeleton loaders
- Toasts: Success and error notifications
The application is fully responsive with:
- Mobile-first design approach
- Collapsible navigation menu
- Touch-friendly interactions
- Optimized layouts for different screen sizes
- Progressive enhancement
Advanced search capabilities include:
- Text Search: Search by article title and content
- Topic Filtering: Filter by news categories
- Sentiment Filtering: Filter by article sentiment
- Source Filtering: Filter by news source
- Date Range: Filter by publication date
- Combined Filters: Use multiple filters simultaneously
User personalization features:
- Topic Preferences: Set preferred news topics
- Personalized Feed: AI-curated content based on preferences
- Reading History: Track viewed articles
- Engagement Metrics: View article popularity and trends
- Request/response logging
- Cache hit/miss ratios
- API response times
- Memory usage monitoring
- Error tracking and reporting
- Redis connectivity
- API endpoint availability
- Service status monitoring
- Performance benchmarks
# Local Development
npm run dev
# Production Deployment
npm start
# Vercel Deployment
vercel --prod# Build for Production
npm run build
# Deploy to Vercel
npm install -g vercel
vercel
# Deploy to Netlify
npm run build
# Upload the dist folder to Netlify- Backend Documentation
- Frontend Documentation
- Cache Management Guide
- Cache Clearing Guide
- API Documentation
Varshith V Hegde (@Varshithvhegde)
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check the documentation in the
/docsfolder - Review the API documentation
- Real-time breaking news notifications
- Live analytics dashboard
- AI-powered chatbot
- Advanced content curation
- Offline reading capabilities
- Push notifications for breaking news
- Social sharing features
- Advanced analytics dashboard
- Multi-language support
- Podcast integration
- Video news summaries
This project is designed for the Redis AI Challenge and demonstrates:
- AI-Powered Content Analysis: Google Gemini AI integration
- Vector Search: Redis-based semantic similarity
- Real-Time Processing: Live news analysis and recommendations
- Personalized AI: ML-based content curation
- Redis as Primary Database: JSON storage with full-text search
- Advanced Redis Features: Vector search, streams, pub/sub
- Performance Optimization: Multi-layer caching strategies
- Scalable Architecture: Handle thousands of concurrent users
Built with โค๏ธ using React, TypeScript, Node.js, Express, Redis, and Google Gemini AI