Phishing attacks account for 90% of all data breaches, with AI-generated scams becoming increasingly difficult to detect. Traditional rule-based filters struggle to keep up with these sophisticated threats.
PhishGuard AI is an intelligent defense layer that leverages Machine Learning (Logistic Regression) and Natural Language Processing (NLP) to analyze email intent, context, and linguistic patterns in real-time.
"Don't just block. Understand."
- 98.3% Accuracy: Trained on the SMS Spam Collection dataset.
- High Recall (91.3%): Prioritizes catching threats to minimize missed attacks.
- Real-Time Analysis: Sub-100ms inference time.
- Cyberpunk Aesthetic: Glassmorphism, neon accents, and Digital Rain effects.
- Live Threat Feed: Real-time visualization of scanned emails.
- Forensic Breakdown: Detailed confidence scores and probability analysis.
- Email Analysis: Paste suspicious email content for instant classification
- Threat Visualization: Color-coded results (Red = Phishing, Green = Safe)
- Forensic Details: Expandable technical analysis with raw model output
- Scan History: Chronological feed of all analyzed emails
- System Status: Real-time engine health monitoring
Watch PhishGuard AI in action:
Try it yourself:
- Clone the repository
- Run
./run_system.sh - Open http://localhost:5173
- Paste a suspicious email and click "SCAN FOR THREATS"
- Framework: React 18 with Vite
- Styling: Vanilla CSS with custom animations
- Fonts: Google Fonts (Outfit, Orbitron)
- Effects: Glassmorphism, Digital Rain, Custom Cursors
- Framework: FastAPI
- Server: Uvicorn (ASGI)
- CORS: Enabled for cross-origin requests
- Algorithm: Logistic Regression
- Feature Engineering: TF-IDF Vectorization
- Text Processing: NLTK (stopwords, stemming)
- Model Persistence: Joblib
- Evaluation: scikit-learn metrics
- Dataset: SMS Spam Collection (UCI ML Repository)
- Size: 5,574 messages
- Split: 80% training, 20% testing
- Python 3.8+
- Node.js 16+
- npm or yarn
- Git
git clone https://github.com/sr-857/phishguard-ai.git
cd phishguard-ai# Install Python dependencies
pip install -r requirements.txt
# Download NLTK data (automatic on first run)
python -c "import nltk; nltk.download('stopwords')"
# Train models (if not already trained)
python src/model_trainer.py# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Return to root
cd ..# Launch both frontend and backend with one command
./run_system.shThis will start:
- Backend API: http://localhost:8000
- Frontend Dashboard: http://localhost:5173
uvicorn src.api:app --reload --port 8000cd frontend
npm run devgraph TD
User[๐ค User] -->|Access Dashboard| Frontend["โ๏ธ React Frontend<br>(GitHub Pages)"]
Frontend -->|POST /predict| Backend["๐ FastAPI Backend<br>(Railway)"]
subgraph "Backend Services"
Backend -->|Text Processing| NLP[๐ NLTK Preprocessing]
NLP -->|Vectorization| TFIDF[๐งฎ TF-IDF Vectorizer]
TFIDF -->|Inference| Model[๐ค Logistic Regression Model]
end
Model -->|Prediction & Score| Backend
Backend -->|JSON Response| Frontend
Frontend -->|Visual Feedback| User
style Frontend fill:#61DAFB,stroke:#333,stroke-width:2px,color:black
style Backend fill:#009688,stroke:#333,stroke-width:2px,color:white
style Model fill:#FF9800,stroke:#333,stroke-width:2px,color:black
- Input: User pastes email content into the React dashboard.
- Request: Frontend sends a secure API request to the FastAPI backend.
- Processing: Backend cleans text (stopwords, stemming) and vectorizes it.
- Inference: ML model predicts probability of phishing.
- Response: Result is returned and visualized with confidence scores.
- Open http://localhost:5173 in your browser
- Paste a suspicious email in the text area
- Click "๐ก๏ธ SCAN FOR THREATS"
- View results and confidence score
- Check the Live Threat Feed for history
URGENT! You have won a ยฃ100,000 Prize Jackpot!
Click here to claim: http://suspicious-link.com
Reply with your bank details to: scammer@fake.com
http://localhost:8000
GET /Response
{
"status": "online",
"model": "Logistic Regression"
}POST /predict
Content-Type: application/jsonRequest Body
{
"text": "Your email content here"
}Response
{
"label": "Phishing/Spam",
"probability": "0.9234",
"raw_text": "Your email content here"
}Visit http://localhost:8000/docs for Swagger UI documentation.
| Metric | Score |
|---|---|
| Accuracy | 98.3% |
| Precision | 98.5% |
| Recall | 91.3% |
| F1-Score | 94.8% |
We chose Logistic Regression over Naive Bayes and Random Forest because:
- High Recall: 91.3% recall minimizes false negatives (missed phishing emails)
- Fast Inference: Real-time predictions with minimal latency
- Interpretability: Clear feature importance for transparency
- Efficiency: Low memory footprint and quick training
phishguard-ai/
โโโ .github/ # GitHub assets
โ โโโ logo.png # Repository logo
โ โโโ dashboard-demo.png # Demo screenshot
โโโ frontend/ # React application
โ โโโ public/
โ โ โโโ cyber_background.png
โ โโโ src/
โ โ โโโ components/
โ โ โ โโโ DigitalRain.jsx
โ โ โ โโโ Testimonials.jsx
โ โ โโโ App.jsx
โ โ โโโ App.css
โ โ โโโ main.jsx
โ โโโ index.html
โ โโโ package.json
โ โโโ vite.config.js
โโโ src/ # Backend & ML
โ โโโ api.py # FastAPI server
โ โโโ data_loader.py # Dataset handling
โ โโโ features.py # Feature engineering
โ โโโ model_trainer.py # Model training
โ โโโ evaluation.py # Performance metrics
โ โโโ inference.py # Prediction engine
โโโ models/ # Trained models
โ โโโ Logistic_Regression.pkl
โ โโโ tfidf_vectorizer.pkl
โ โโโ ...
โโโ .gitignore
โโโ requirements.txt
โโโ run_system.sh # Launch script
โโโ CONTRIBUTING.md
โโโ CODE_OF_CONDUCT.md
โโโ SECURITY.md
โโโ README.md
We welcome contributions! See CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Developer: Subhajit Roy
- ๐ง Email: subhajitroy857@gmail.com
- ๐ผ LinkedIn: linkedin.com/in/sr857
- ๐ GitHub: github.com/sr-857
- Dataset: SMS Spam Collection from UCI ML Repository
- Inspiration: Modern cybersecurity dashboards and threat intelligence platforms
- Libraries: React, FastAPI, scikit-learn, NLTK, and the amazing open-source community
Made with โค๏ธ and โ by Subhajit Roy


