AI-Powered News Aggregation Platform with 11 Intelligent Features
PulsePress is a production-ready backend API that aggregates news from 70+ sources (NewsAPI, The Guardian, NY Times, and 130+ RSS feeds) and enhances articles with AI-powered features including summarization, sentiment analysis, tag generation, and personalized recommendations.
AI-generated concise summaries using Google Gemini 2.5 models with intelligent content truncation and context preservation.
Real-time sentiment detection with confidence scores, emotional indicators, and color-coded visualization.
Automatic extraction of 3-5 crucial points from articles for quick comprehension.
AI-powered complexity assessment analyzing vocabulary, sentence structure, and technical terminology.
Intelligent categorization with contextual tags for improved discoverability and navigation.
Location extraction and mapping for geographical context awareness.
AI-generated platform-specific captions optimized for Twitter, LinkedIn, and Facebook engagement.
Intelligent question generation for deeper engagement and context-aware question answering using article content.
Advanced contextual analysis, including stakeholder impact, timeline connections, and theme identification.
Google Translate integration supporting 100+ languages for global accessibility.
Non-news content detection with an intelligent strike system for quality control.
- 70+ News Sources: NewsAPI.org, The Guardian, NY Times, 130+ RSS feeds
- Multi-Language Support: English, Bengali, Hindi content + 26 AI languages
- Smart Deduplication: URL-based article deduplication
- Real-Time Processing: Background AI enhancement pipeline
- Reading History Tracking: Engagement analytics
- Custom Feeds: User-defined categories and sources
- Bookmark Management: Save and organize articles
- 3 Authentication Methods: Email/Password, Google OAuth 2.0, Magic Links
- JWT Token Management: Access + Refresh token rotation
- Strike System: Abuse prevention with auto-recovery
- Rate Limiting: Endpoint-specific quotas
- API Quota Management: Per-user usage tracking
- 21 Health Checks: Database, AI services, external APIs
- Source Performance: Quality scoring and tracking
- User Engagement Metrics: Reading patterns and preferences
- Real-Time Monitoring: System health dashboard
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT APPLICATIONS β
β (Web, Mobile, Desktop, etc.) β
βββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β HTTP/REST
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EXPRESS API SERVER (PORT 4000) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ CORS & Security Middleware β
β β’ JWT Authentication β
β β’ Rate Limiting β
β β’ Request Logging β
βββββββββββββ¬βββββββββββββ¬βββββββββββββ¬ββββββββββββββββ
β β β
βββββββΌβββββ ββββββΌβββββ ββββββΌββββββ
β News β β AI β β Auth β
β Services β βServices β β Services β
βββββββ¬βββββ ββββββ¬βββββ ββββββ¬ββββββ
β β β
βββββββΌββββββββββββΌββββββββββββΌββββββ
β EXTERNAL SERVICES β
β β’ NewsAPI, Guardian, NYTimes β
β β’ 130+ RSS Feeds β
β β’ Google Gemini AI (3 models) β
β β’ Google Translate API β
ββββββββββββββββββ¬ββββββββββββββββββββ
β
βββββββΌββββββ
β MongoDB β
β Database β
βββββββββββββ
- Node.js 18+
- MongoDB 8.16.5+
- npm (comes with Node.js)
- Clone the repository
git clone https://github.com/chayan-1906/PulsePress-Node.js.git
cd PulsePress-Node.js- Install dependencies
npm install- Configure environment variables
cp .env.example .envEdit .env with your credentials (see Environment Variables)
- Start the server
# Development mode with hot reload
npm run dev
# Production mode
npm run build
npm startServer runs at http://localhost:4000
Create a .env file in the root directory with the following variables:
# Server
PORT=4000
NODE_ENV=development
# Database
MONGO_URI=mongodb://localhost:27017/pulsepress
# Or MongoDB Atlas: mongodb+srv://<username>:<password>@cluster.mongodb.net/pulsepress# JWT Secrets (generate with: openssl rand -base64 32)
JWT_SECRET=your_jwt_secret_here
JWT_REFRESH_SECRET=your_refresh_secret_here
JWT_EXPIRES_IN=15m
JWT_REFRESH_EXPIRES_IN=7d
# Google OAuth 2.0
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REDIRECT_URI=http://localhost:4000/api/v1/auth/google/callback# NewsAPI.org (https://newsapi.org)
NEWS_API_KEY=your_newsapi_key
# The Guardian (https://open-platform.theguardian.com)
THE_GUARDIAN_API_KEY=your_guardian_key
# NY Times (https://developer.nytimes.com)
NY_TIMES_API_KEY=your_nytimes_key# Google Gemini AI (https://ai.google.dev)
GEMINI_API_KEY=your_gemini_api_key
# Google Cloud Translate (https://cloud.google.com/translate)
GOOGLE_TRANSLATE_API_KEY=your_translate_key
# HuggingFace (Optional - https://huggingface.co)
HUGGINGFACE_API_KEY=your_huggingface_key# SMTP Configuration (e.g., Gmail)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASSWORD=your_app_password
EMAIL_FROM=noreply@pulsepress.com# AI Features
AI_WINDOW_MS=300000 # 5 minutes
AI_MAX_REQUESTS=30
# News Scraping
NEWS_SCRAPING_WINDOW_MS=900000 # 15 minutes
NEWS_SCRAPING_MAX_REQUESTS=50Note: See
.env.examplefor complete configuration options
Complete API documentation with all 75 endpoints is available in API_DOCUMENTATION.md
| Category | Endpoints | Description |
|---|---|---|
| Authentication | 10 | Register, login, OAuth, magic links, token refresh |
| News | 15 | Multi-source fetch, search, enhanced articles |
| AI Features | 11 | Summarization, sentiment, tags, insights, Q&A |
| Personalization | 8 | Preferences, recommendations, reading history |
| Bookmarks | 5 | Save, organize, and manage articles |
| Analytics | 6 | User metrics, source performance, engagement |
| Health | 21 | System monitoring and diagnostics |
Request:
GET /api/v1/news/multisource/enhanced?q=technology&pageSize=10
Authorization: Bearer <your_jwt_token>Response:
{
"success": true,
"message": "Articles fetched and enhancement started",
"data": {
"articles": [
{
"articleId": "abc123...",
"title": "AI Breakthrough in Healthcare",
"url": "https://...",
"source": "TechCrunch",
"publishedAt": "2025-01-20T10:30:00Z",
"enhancements": {
"processingStatus": "completed",
"summary": "...",
"sentiment": {
"type": "positive",
"confidence": 0.89,
"emoji": "π"
},
"tags": ["AI", "Healthcare", "Innovation"],
"readingTime": "5 minutes"
}
}
],
"totalResults": 150,
"page": 1,
"pageSize": 10
}
}pulsepress/
βββ src/
β βββ server.ts # Application entry point
β βββ config/ # Configuration files
β β βββ config.ts # Environment variables
β β βββ connectDB.ts # MongoDB connection
β βββ controllers/ # Request handlers (10 controllers)
β β βββ NewsController.ts
β β βββ AIController.ts
β β βββ AuthController.ts
β β βββ ...
β βββ services/ # Business logic (25 services)
β β βββ NewsService.ts
β β βββ ArticleEnhancementService.ts
β β βββ ContentRecommendationService.ts
β β βββ ...
β βββ models/ # MongoDB schemas (10 models)
β β βββ UserSchema.ts
β β βββ ArticleEnhancementSchema.ts
β β βββ BookmarkSchema.ts
β β βββ ...
β βββ routes/ # API routes
β βββ middlewares/ # Auth, rate limiting
β βββ types/ # TypeScript interfaces
β βββ utils/ # Helper functions
βββ .env.example # Environment template
βββ package.json # Dependencies
βββ tsconfig.json # TypeScript config
βββ README.md # This file
- Runtime: Node.js 18+
- Framework: Express 5.1.0
- Language: TypeScript 5.8.3
- Database: MongoDB 8.16.5 (Mongoose ODM)
- Google Gemini AI: 2.5 Flash Preview, 2.0 Flash, 1.5 Flash
- Google Translate API: Multi-language support
- HuggingFace Inference: Backup AI models
- Fuse.js: Fuzzy search
- NewsAPI.org: Global news headlines
- The Guardian: Premium journalism
- NY Times: Quality news archives
- RSS Feeds: 130+ real-time feeds (English, Bengali, Hindi)
- JWT: Token-based authentication
- bcryptjs: Password hashing
- Google OAuth 2.0: Social login
- express-rate-limit: API protection
- Axios: HTTP client
- Cheerio: HTML parsing
- JSDOM + Readability: Article extraction
- node-cron: Scheduled tasks
- Nodemailer: Email service
# Development
npm run dev # Start with hot reload (nodemon)
# Production
npm run build # Compile TypeScript to JavaScript
npm start # Run compiled codePOST /api/v1/auth/register
{
"name": "John Doe",
"email": "john@example.com",
"password": "SecurePass123!"
}
POST /api/v1/auth/login
{
"email": "john@example.com",
"password": "SecurePass123!"
}
Response:
{
"accessToken": "eyJhbGc...",
"refreshToken": "eyJhbGc...",
"user": { ... }
}
GET /api/v1/news/multisource
Authorization: Bearer eyJhbGc...
POST /api/v1/auth/refresh
{
"refreshToken": "eyJhbGc..."
}
- Article Fetch: Retrieve from multiple sources
- Initial Processing: Return basic data immediately
- Background Enhancement: Queue AI processing
- Status Polling: Client checks enhancement status
- Cached Results: Serve enhanced data from MongoDB
Protects AI features from abuse:
- Warning (1 strike): Alert message
- Cooldown (2 strikes): 15-minute AI block
- Temporary Ban (3 strikes): 2-hour AI block
- Auto-Recovery: Strikes decay over time
21 health checks across:
- Database connectivity
- External API availability (NewsAPI, Guardian, NYTimes)
- AI service status (Gemini, Translate)
- Memory usage
- Uptime tracking
Endpoint: GET /api/v1/health
All endpoints return consistent error responses:
{
"success": false,
"error": {
"code": "AUTH_001",
"message": "Invalid credentials",
"details": "Email or password is incorrect"
}
}Error Code Ranges:
AUTH_xxx: Authentication errorsNEWS_xxx: News fetching errorsAI_xxx: AI processing errorsQUOTA_xxx: Rate limit errorsDB_xxx: Database errors
Contributions are welcome! Please follow these steps:
- 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
- Follow existing TypeScript patterns
- Use meaningful variable/function names
- Add JSDoc comments for complex logic
- Write unit tests for new features
This project is licensed under the MIT License - see the LICENSE file for details.
Summary: Free to use, modify, and distribute with attribution.
Padmanabha Das
- π§ Email: padmanabhadas9647@gmail.com
- πΌ LinkedIn: linkedin.com/in/padmanabha-das-59bb2019b
- π GitHub: github.com/chayan-1906
- π Medium: chayan-1906.medium.com
- π» Dev.to: dev.to/chayan-1906
- Google Gemini AI for powerful language models
- NewsAPI.org, The Guardian, NY Times for news data
- Open-source community for excellent libraries
- MongoDB for flexible data storage
- API Documentation - Complete endpoint reference
- Architecture Deep Dive - Technical documentation
- Issue Tracker - Report bugs or request features
- News Applications: Power mobile/web news apps
- Content Aggregators: Build custom news feeds
- Research Tools: Analyze news trends and sentiment
- Enterprise Dashboards: Monitor industry news
- Educational Platforms: Create comprehension exercises
- Social Media Tools: Generate shareable content
β Star this repo if you find it useful!
Made with β€οΈ by Padmanabha Das