AI-assisted risk assessment tool for detecting potential scams, phishing, and fraud in digital content. This system provides decision support only and is not a guaranteed scam detector. Always verify suspicious content through official channels.
The application runs in Demo Mode by default โ no API key required.
| Service | URL |
|---|---|
| Backend API | http://localhost:5000 |
| Web Dashboard | http://localhost:5174 (or 5173) |
| API Health | http://localhost:5000/api/health |
Millions of people worldwide fall victim to scams, phishing, and digital fraud every year. Fraudsters exploit human psychology with urgency, fear, and impersonation to steal money and personal information. Most victims don't have the technical expertise to identify suspicious content before it's too late.
TrustGuard addresses this gap by providing an AI-powered decision support tool that:
- Analyzes suspicious content for risk indicators
- Explains WHY content is considered risky
- Provides evidence-backed guidance from a cybersecurity knowledge base
- Recommends specific safety actions
- Detect scam/phishing/fraud risk in text, URLs, webpages, and screenshots
- Generate transparent 0โ100 risk scores with factor breakdown
- Classify content into 12 scam categories
- Provide explainable AI reasons for every risk assessment
- Back explanations with RAG-retrieved cybersecurity knowledge
- Deliver results via browser extension (real-time) and web dashboard
| Feature | Description |
|---|---|
| ๐ Text Analysis | Analyze SMS, email, WhatsApp messages, or any text |
| ๐ URL Analysis | Check URLs for phishing patterns and suspicious characteristics |
| ๐ Page Scanner | Analyze full webpage content via browser extension |
| ๐ธ Screenshot OCR | Upload screenshots โ OCR extracts text โ AI analyzes |
| ๐ง Explainable AI | Every score comes with specific reasons and supporting evidence |
| ๐ RAG Pipeline | 22+ cybersecurity knowledge documents back every analysis |
| ๐ฌ AI Chat | Conversational assistant to explain results in plain language |
| ๐ Dashboard | Charts showing risk distribution, trends, and categories |
| ๐ History | Search, filter, and manage all previous analyses |
| ๐ Extension | Chrome/Edge MV3 extension with popup and context menus |
| ๐ญ Demo Mode | Fully functional without any API key |
| โ๏ธ Admin View | System status, memory usage, API endpoint reference |
Browser Extension (Manifest V3)
โ
โโโ Popup UI (popup.html/js/css)
โโโ Content Script (content.js)
โโโ Background Worker (background.js)
โ
โผ
Backend REST API (Express.js :5000)
โ
โโโ Input Validation & Rate Limiting
โ
โโโ Risk Scoring Engine (Heuristic, 0-100)
โ โโโ Keyword detection, URL analysis
โ
โโโ RAG Knowledge Retrieval
โ โโโ 22 cybersecurity knowledge docs
โ โโโ Keyword-based semantic matching
โ
โโโ AI Analysis (Google Gemini API)
โ โโโ Structured JSON response
โ โโโ Demo Mode fallback
โ
โโโ MongoDB (Analysis, ChatSession models)
โ
โผ
Web Dashboard (React + Vite :5173)
โ
โโโ Landing Page
โโโ Dashboard (Chart.js)
โโโ Analyze Page (4 input types)
โโโ History Page (search/filter/paginate)
โโโ Report Page (full detail)
โโโ Admin Page
| Layer | Technology |
|---|---|
| Browser Extension | Chrome Manifest V3, Vanilla JS/CSS |
| Frontend | React 19, Vite, React Router, Chart.js, Axios |
| Backend | Node.js, Express.js |
| Database | MongoDB + Mongoose |
| AI Integration | Google Gemini API (gemini-1.5-flash) |
| RAG | Keyword-based knowledge retrieval (22 docs) |
| OCR | Tesseract.js |
| File Upload | Multer |
| Security | Helmet, CORS, express-rate-limit, express-validator |
trustguard/
โโโ extension/ # Chrome/Edge MV3 Extension
โ โโโ manifest.json
โ โโโ popup/ # Popup UI (HTML/JS/CSS)
โ โโโ content/ # Content script (page extraction)
โ โโโ background/ # Service worker (context menus, notifications)
โ โโโ options/ # Settings page
โ โโโ assets/icons/ # Extension icons
โ
โโโ frontend/ # React + Vite Dashboard
โ โโโ src/
โ โ โโโ components/ # Reusable UI components
โ โ โ โโโ RiskComponents.jsx
โ โ โ โโโ ChatPanel.jsx
โ โ โโโ pages/ # Route pages
โ โ โ โโโ LandingPage.jsx
โ โ โ โโโ Dashboard.jsx
โ โ โ โโโ AnalyzePage.jsx
โ โ โ โโโ HistoryPage.jsx
โ โ โ โโโ ReportPage.jsx
โ โ โ โโโ AdminPage.jsx
โ โ โโโ services/api.js # API service layer
โ โ โโโ index.css # Design system
โ โโโ vite.config.js
โ
โโโ backend/ # Node.js/Express API
โ โโโ server.js # App entry point
โ โโโ controllers/ # Route handlers
โ โโโ routes/ # Express routes
โ โโโ models/ # MongoDB schemas
โ โโโ services/
โ โ โโโ riskScoring.js # Heuristic scoring engine
โ โโโ ai/
โ โ โโโ aiService.js # Gemini API abstraction
โ โ โโโ prompts.js # Prompt templates
โ โ โโโ demoMode.js # Demo scenarios
โ โโโ rag/
โ โ โโโ knowledgeBase.js # 22 cybersecurity docs + retrieval
โ โโโ utils/
โ โโโ database.js # MongoDB connection
โ
โโโ dataset/
โ โโโ sample_data.json # 12 labeled development samples
โ
โโโ tests/
โ โโโ api.test.js # 24-test suite
โ
โโโ .env.example # Environment variable template
โโโ README.md
# Copy to backend/.env
PORT=5000
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/trustguard
GEMINI_API_KEY=your_gemini_api_key_here # Get from aistudio.google.com
AI_MODEL=gemini-1.5-flash
DEMO_MODE=true # Set false when API key is ready
API_SECRET_KEY=trustguard_local_secret
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
MAX_FILE_SIZE_MB=5- Node.js 18+
- MongoDB (optional โ app works without it in demo mode)
- Chrome or Edge browser
# The project is already in: C:\Users\veeno\OneDrive\Desktop\TRUSTGUARD AIcd backend
npm install
# Copy .env.example to .env and configure
cp ../.env.example .env
# Start backend
npm run dev
# Server runs on http://localhost:5000cd frontend
npm install
npm run dev
# Dashboard runs on http://localhost:5173# From project root
node tests/api.test.js
# Expected: 24 passed, 0 failed- Open Chrome/Edge โ
chrome://extensions - Enable Developer Mode (toggle top-right)
- Click "Load unpacked"
- Select the
extension/folder - Extension appears in toolbar โ click ๐ก๏ธ TrustGuard
Note: For the extension to work, the backend must be running on
http://localhost:5000. You can change the backend URL in the extension's Settings (right-click extension โ Options).
- Get a free Gemini API key from aistudio.google.com
- Edit
backend/.env - Set
GEMINI_API_KEY=your_actual_key - Set
DEMO_MODE=false - Restart backend
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health |
Backend health check |
| POST | /api/analyze/text |
Analyze text content |
| POST | /api/analyze/url |
Analyze URL |
| POST | /api/analyze/page |
Analyze webpage |
| POST | /api/analyze/screenshot |
Upload image for OCR + analysis |
| POST | /api/chat |
AI chat with analysis context |
| POST | /api/rag/search |
Search knowledge base |
| GET | /api/analysis/history |
Get analysis history |
| GET | /api/analysis/:id |
Get specific analysis |
| DELETE | /api/analysis/:id |
Delete analysis |
| GET | /api/dashboard/statistics |
Dashboard stats |
| GET | /api/dashboard/admin |
Admin/developer stats |
POST /api/analyze/text
Content-Type: application/json
{
"text": "URGENT: Your bank account has been suspended..."
}
Response:
{
"analysisId": "uuid",
"riskScore": 87,
"riskLevel": "CRITICAL",
"categories": ["Phishing Risk", "Account Takeover Risk"],
"indicators": [...],
"summary": "...",
"recommendations": [...],
"uncertainty": "...",
"ragEvidence": [...]
}Demo Mode provides realistic pre-configured analysis scenarios without requiring a Gemini API key.
Demo Scenarios:
- ๐ฆ Fake Bank Alert SMS โ CRITICAL (91/100)
- ๐ Prize/Reward Scam โ CRITICAL (87/100)
- ๐ Investment Scam โ CRITICAL (84/100)
- ๐ Suspicious Shopping Website โ HIGH (62/100)
- โ Legitimate Website โ LOW (8/100)
All demo results are clearly labeled with โก DEMO DATA.
| Score Range | Level | Meaning |
|---|---|---|
| 0 โ 20 | โ LOW | No significant indicators detected |
| 21 โ 50 | Some suspicious characteristics | |
| 51 โ 75 | ๐ด HIGH | Multiple risk indicators detected |
| 76 โ 100 | ๐จ CRITICAL | Strong scam/fraud indicators |
Score = 0.7 ร AI Score + 0.3 ร Heuristic Score
- โ API keys stored server-side only (never in extension or frontend)
- โ Rate limiting (100 req/15 min by default)
- โ Input validation on all endpoints
- โ File type and size validation for uploads
- โ CORS configured for extension and frontend origins only
- โ Helmet security headers
- โ No silent browsing history collection
- โ Extension only activates when user explicitly requests analysis
- Not a guaranteed detector โ AI pattern detection can have false positives/negatives
- No real-time blocklist โ Does not check URLs against live threat intelligence feeds
- OCR accuracy โ Image quality affects text extraction
- Demo Mode โ Pre-configured results are illustrative, not from actual AI analysis
- No authentication โ Backend should be deployed with proper auth in production
- RAG โ Uses keyword-based matching; production system would benefit from vector search
- Vector database (Pinecone/ChromaDB) for semantic RAG
- Real-time URL reputation checking (VirusTotal API)
- User authentication and multi-user support
- Email header analysis
- Browser history analysis (opt-in only)
- Evaluation metrics dashboard (F1, AUC-ROC)
- Fine-tuned model on labeled scam dataset
- Multi-language support
- Mobile app
TrustGuard provides AI-assisted risk assessment and is not a guaranteed scam detector. Results should not be treated as definitive legal or financial conclusions. Users should independently verify suspicious content through trusted official channels. This system assists human judgment โ it does not replace it.
Built with โค๏ธ for cybersecurity awareness and digital safety.