Skip to content

NarutoCoder1111/NewsHub-AI-TruthLens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“° NewsHub AI TruthLens

A full-stack news platform with live news feeds, a role-based editorial system, and a multi-layer AI fact-checking engine that verifies the authenticity of any news article or text.

Node.js Express PostgreSQL Gemini


✨ Features

πŸ” Authentication

  • Register with OTP email verification
  • Login with email & password
  • Google OAuth login
  • Forgot password / reset password via email
  • Role-based access β€” Reader, Editor, Admin

πŸ“‘ News Main Site

  • Live breaking news ticker
  • Hero section with featured article
  • Editor's Picks section
  • Latest news grid
  • Category navbar β€” National, Global, Technology, Education, Sports, Business, Entertainment, Health, Science, Politics
  • Single article pages with comments
  • Dark / Light theme toggle
  • AI Fact Check button in navbar
  • Mobile responsive with hamburger menu

πŸ‘€ User Profile

  • Edit personal info (name, email, role)
  • Change password
  • Notification preferences β€” breaking news, digest, recommendations, newsletter
  • Editor profile β€” handle, bio, avatar URL

✍️ Editor Dashboard

  • Article stats overview
  • Write new articles with draft / submit workflow
  • Edit draft and rejected articles
  • Comments on own articles
  • Delete request system (request admin approval)

πŸ›‘οΈ Admin Panel

  • Dashboard with platform-wide stats
  • Full article management β€” approve, reject (with note), delete, toggle breaking/featured flags
  • User management β€” activate/deactivate, change roles, delete
  • Editor profiles with stats
  • Comment moderation β€” hide, unflag, delete
  • Delete request management β€” approve or deny
  • OTP log viewer with clear-expired option

πŸ” AI Truth Lens (Fact Checker)

  • Paste text or enter a URL to analyze
  • Multi-layer AI chain with fallback:
    • Google Gemini 2.5 β†’ Gemini 1.5 β†’ Groq β†’ Cohere β†’ HuggingFace β†’ Local ML model
  • Confidence score with animated ring
  • Credibility score & red flag detection
  • Credibility signals breakdown
  • Claims to verify with Google search links
  • Text statistics β€” word count, caps ratio, exclamation density
  • AI-verified source suggestions
  • Related articles from NewsAPI, GNews, NewsData, MediaStack, Wikipedia, RSS
  • Analysis history per session
  • Feedback system that incrementally trains the local ML model
  • Rate limiting β€” 20 requests per 15 minutes

πŸ€– Local ML Model

  • HashingVectorizer + PassiveAggressiveClassifier
  • predict.py β€” inference
  • hashing_train.py β€” incremental learning from user feedback
  • auto_updater.py β€” fetches live headlines, generates fake variants, retrains on schedule
  • Training data across all news categories

πŸ› οΈ Tech Stack

Layer Technology
Backend Node.js, Express.js
Templating EJS, express-ejs-layouts
Styling CSS
Database PostgreSQL
Auth Passport.js (Local + Google OAuth), express-sessions
Email Nodemailer SMTP
AI Services Google Gemini 2.5/1.5, Groq, Cohere, HuggingFace
Local ML Python (scikit-learn)
News APIs NewsAPI, GNews, NewsData, MediaStack
Push Notifications VAPID Web Push
Caching node-cache

πŸ“ Project Structure

newshub-ai-truthlens/
β”œβ”€β”€ routes/              # Express route handlers
β”œβ”€β”€ views/               # EJS templates (auth, news, admin layouts)
β”œβ”€β”€ public/              # Static assets (CSS, JS, images)
β”œβ”€β”€ ml/
β”‚   β”œβ”€β”€ predict.py       # ML inference
β”‚   β”œβ”€β”€ hashing_train.py # Incremental training
β”‚   └── auto_updater.py  # Scheduled retraining
β”œβ”€β”€ .env.example         # Environment variable template
β”œβ”€β”€ app.js               # Main app entry point
└── README.md

βš™οΈ Getting Started

Prerequisites

  • Node.js v18+
  • PostgreSQL
  • Python 3.x with scikit-learn (pip install scikit-learn)

1. Clone the repository

git clone https://github.com/your-username/newshub-ai-truthlens.git
cd newshub-ai-truthlens

2. Install Node dependencies

npm install

3. Install Python dependencies

pip install scikit-learn requests

4. Set up environment variables

cp .env.example .env

Open .env and fill in all your API keys and config values.

5. Set up the PostgreSQL database

  • Create a database in PostgreSQL
  • Update DATABASE_URL in your .env
  • Run any SQL migration files if included

6. Start the server

node app.js

Or with auto-reload:

npx nodemon app.js

Visit http://localhost:3000


πŸ” Environment Variables

See .env.example for all required variables. Never commit your .env file.


🌐 APIs Used

Service Purpose
NewsAPI Main news feed
GNews Additional news source
NewsData.io News data
MediaStack Live news stream
Google Gemini Primary AI fact checking
Groq AI fallback
Cohere AI fallback
HuggingFace AI fallback
Google OAuth Social login

🀝 Contributing

Pull requests are welcome! Please open an issue first to discuss major changes.


πŸ“„ License

MIT

About

Full-stack news platform with AI fact checking

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors