A frontend-only simulation of an enterprise-grade AI-powered phishing detection and prevention system. This project showcases advanced threat detection, real-time analytics, and AI-powered analysis without requiring any backend infrastructure.
- Overview
- Features
- Tech Stack
- Quick Start
- Installation
- Project Structure
- Architecture
- Components
- Simulation Logic
- Deployment
- Development
- Troubleshooting
- License
PhishGuard AI is a demonstration of a modern Security Operations Center (SOC) dashboard that simulates real-time phishing threat detection. Built entirely on the frontend using React and Vite, it provides a realistic, interactive experience of an AI-powered security system without the complexity of backend infrastructure.
- β Zero Backend Complexity - No servers, databases, or APIs to manage
- β Instant Setup - Run anywhere with just Node.js installed
- β Perfect for Demos - Ideal for presentations, hackathons, and portfolios
- β Production-Ready UI - Professional design that looks like a real enterprise system
- β Fully Interactive - All features work with simulated data
- Real-time Statistics Cards
- Active Phishing Alerts counter
- Links Scanned (auto-incrementing)
- Detection Accuracy (97.8%)
- Zero-Day Detections
- Animated Progress Bars - Visual indicators with smooth transitions
- Color-coded Indicators - Red, green, yellow for different threat levels
- Auto-generating Alerts - New phishing alerts every 4 seconds
- Threat Level Classification - High, Medium, Low with color-coded badges
- AI Confidence Scores - Percentage bars showing detection confidence
- Realistic Domains - Typosquatting simulation (paypal1-secure.com, microsoft-verify.net)
- Detection Types - URL Analysis, Email Content, SMS Pattern, Domain Reputation
- Interactive Details - Click to view comprehensive threat analysis
- Text Input Analysis - Paste any email or SMS content
- Simulated Processing - 2-second AI analysis animation
- Detailed Threat Report
- Confidence percentage
- Specific detection reasons
- Recommended actions
- Randomized Responses - Realistic but varied outputs
- SVG-based Visualization - Domain relationship graph
- Animated Connections - Flowing lines between nodes
- Color-coded Nodes - Red (High), Yellow (Medium), Green (Low)
- Auto-refresh - Updates every 8 seconds
- Interactive Design - Shows malicious infrastructure connections
- Time Series Chart - Phishing activity over 24 hours (Recharts)
- Distribution Pie Chart - Threat sources (Email 45%, SMS 25%, Web 20%, AI-Generated 10%)
- Smooth Animations - Responsive chart interactions
- Real-time Updates - Data refreshes periodically
- Modal Dialog Interface - Detailed threat analysis overlay
- AI-generated Explanations - Natural language threat descriptions
- Threat Indicators List - Specific red flags detected
- Security Recommendations - Step-by-step action items
- Smooth Transitions - Framer Motion animations
- Live Metrics
- CPU Load simulation (20-50%)
- Model Uptime (99.98%)
- API Latency (15-35ms)
- Threats Blocked (24h counter)
- AI Model Version - v3.2.1
- Animated Progress Bar - System health indicator
- React 18.3 - Modern UI library with hooks
- Vite 6.0 - Lightning-fast build tool and dev server
- TailwindCSS 3.4 - Utility-first CSS framework
- JavaScript (ES6+) - Modern JavaScript features
- Framer Motion 11.x - Smooth animations and transitions
- Lucide React - Beautiful icon library
- Radix UI - Accessible component primitives
- Recharts 2.15 - React chart library
- Line charts for trends
- Pie charts for distribution
- Responsive containers
- PostCSS - CSS transformation
- Autoprefixer - CSS vendor prefixing
- ESLint (optional) - Code linting
# Run the automated setup script
python run.py
This will:
- Check for Node.js and npm
- Install all dependencies
- Start the development server
- Open http://localhost:5000
# 1. Navigate to frontend directory
cd frontend
# 2. Install dependencies
npm install
# 3. Start development server
npm run dev
# 4. Open browser
# Visit http://localhost:5000
- Node.js 18.0 or higher (Download)
- npm 9.0 or higher (comes with Node.js)
- Git (optional, for cloning)
-
Clone or Download the Project
git clone <repository-url> cd PhishGuard-AI
-
Install Dependencies
cd frontend npm install
-
Start Development Server
npm run dev
-
Access the Application
- Open browser to
http://localhost:5000
- The dashboard should load immediately
- Open browser to
After starting, you should see:
- Console message:
[PhishGuard AI] Model v3.2 loaded | Live threat monitoring initialized
- Dashboard with live stats
- Auto-generating alerts every 4 seconds
PhishGuard-AI/
βββ frontend/ # Main React application
β βββ src/
β β βββ components/ # React components
β β β βββ Dashboard.jsx # Stats dashboard with cards
β β β βββ AlertsTable.jsx # Live alerts feed table
β β β βββ Analyzer.jsx # AI text analysis component
β β β βββ ThreatGraph.jsx # Network visualization
β β β βββ TrendCharts.jsx # Analytics charts
β β β βββ ExplainPanel.jsx # AI explanation modal
β β β βββ SystemStatus.jsx # System health panel
β β βββ data/
β β β βββ sample_alerts.json # Initial seed data
β β βββ utils/
β β β βββ fakeData.js # Mock data generators
β β βββ App.jsx # Main app component
β β βββ main.jsx # Entry point
β β βββ index.css # Global styles + Tailwind
β βββ public/ # Static assets
β βββ index.html # HTML template
β βββ package.json # Dependencies
β βββ vite.config.js # Vite configuration
β βββ tailwind.config.js # Tailwind configuration
β βββ postcss.config.js # PostCSS configuration
β βββ .gitignore # Git ignore rules
βββ old_files/ # Legacy code (archived)
βββ run.py # Auto-setup script
βββ README.md # This file
βββ replit.md # Replit-specific docs
βββ .gitignore # Root gitignore
App
βββ Header (Logo, Status Indicator)
βββ Dashboard (Stats Cards)
β βββ StatCard Γ 4
βββ AlertsTable (Live Feed)
β βββ AlertRow Γ N
βββ Analyzer (AI Text Input)
β βββ AnalysisResult
βββ TrendCharts
β βββ LineChart (Activity)
β βββ PieChart (Distribution)
βββ SystemStatus (Metrics Panel)
βββ ThreatGraph (Network Map)
Modal Overlays:
βββ ExplainPanel (Threat Details)
User Interaction
β
State Update (React Hooks)
β
Component Re-render
β
Animation Trigger (Framer Motion)
β
Visual Update
setInterval Timers
β
Data Generators (fakeData.js)
β
State Updates (useState)
β
UI Refresh (React)
Purpose: Display key metrics and statistics
Features:
- 4 animated stat cards
- Auto-incrementing counters
- Progress bar animations
- Color-coded indicators
State:
activeAlerts
- Count of active threatslinksScanned
- Total scanned (increments)
Purpose: Show live phishing alerts feed
Features:
- Auto-scrolling table
- Color-coded threat badges
- Confidence progress bars
- Click to view details
Props:
alerts
- Array of alert objectsonViewDetails
- Callback for details
Purpose: AI-powered text analysis
Features:
- Text input area
- Loading animation
- Result display with reasons
- Action recommendations
State:
text
- Input contentanalyzing
- Loading stateresult
- Analysis output
Purpose: Visualize domain relationships
Features:
- SVG-based rendering
- Animated nodes and connections
- Color-coded by threat level
- Auto-refresh every 8s
Props:
graphData
- Nodes and links
Purpose: Display analytics charts
Features:
- Line chart (time series)
- Pie chart (distribution)
- Responsive design
- Tooltip interactions
Props:
trendData
- Time series arraydistributionData
- Pie chart data
Purpose: Detailed threat explanation
Features:
- Modal overlay
- AI-generated text
- Indicator list
- Recommendations
Props:
alert
- Selected alert objectonClose
- Close callback
Purpose: Show system health
Features:
- Live metrics
- Animated values
- Progress indicator
- Model version info
Generates realistic phishing domains with typosquatting:
// Examples:
// paypal1-secure.com
// microsoft-verify.net
// amazon-login.com
Returns weighted threat levels:
- Low: 30%
- Medium: 40%
- High: 30%
Creates complete alert objects:
{
id: string,
timestamp: ISO string,
domain: string,
sender: string,
threatLevel: "High"|"Medium"|"Low",
detectionType: string,
confidence: "85-99%",
status: "Active",
description: string
}
Creates AI explanation based on alert:
{
confidence: number,
type: string,
explanation: string,
recommendations: string[],
indicators: string[]
}
Interval | Duration | Purpose |
---|---|---|
Alert Generation | 4s | New phishing alerts |
Graph Update | 8s | Network map refresh |
Stats Increment | 3s | Links scanned counter |
System Stats | 3s | CPU/latency updates |
cd frontend
npm run build
Output: frontend/dist/
(optimized static files)
npm install -g vercel
cd frontend
vercel --prod
cd frontend
npm run build
# Drag & drop 'dist' folder to Netlify
# Set base path in vite.config.js
export default defineConfig({
base: '/your-repo-name/',
// ...
})
npm run build
# Push dist/ to gh-pages branch
No environment variables needed! Everything runs client-side.
Command | Description |
---|---|
npm run dev |
Start dev server (port 5000) |
npm run build |
Build for production |
npm run preview |
Preview production build |
npm start |
Alias for npm run dev |
npm run dev
# Server runs at:
# - Local: http://localhost:5000
# - Network: http://[your-ip]:5000
Changes to .jsx
, .js
, .css
files automatically reload in browser.
-
Create Component
// src/components/MyComponent.jsx export default function MyComponent() { return <div>...</div> }
-
Import in App.jsx
import MyComponent from './components/MyComponent'
-
Add Styling (Tailwind classes)
<div className="card bg-dark-card">...</div>
Edit tailwind.config.js
:
theme: {
extend: {
colors: {
'neon-green': '#00ff88', // Change this
'neon-blue': '#00d4ff', // And this
}
}
}
Edit timers in App.jsx
:
// Alert generation (default: 4000ms)
setInterval(() => {
const newAlert = generateAlert();
// ...
}, 4000); // Change this value
Problem: Error: Port 5000 is already in use
Solution:
# Option 1: Kill the process
# On Mac/Linux:
lsof -ti:5000 | xargs kill -9
# On Windows:
netstat -ano | findstr :5000
taskkill /PID <PID> /F
# Option 2: Use different port
npm run dev -- --port 3000
Problem: npm install
fails
Solution:
# Clear npm cache
npm cache clean --force
# Remove node_modules and reinstall
rm -rf node_modules package-lock.json
npm install
Problem: Application shows blank page
Solution:
- Check browser console for errors
- Verify Node.js version (18+)
- Clear browser cache (Ctrl+Shift+R)
- Rebuild:
npm run build npm run preview
Problem: UI looks unstyled
Solution:
# Rebuild Tailwind
npx tailwindcss -i ./src/index.css -o ./dist/output.css
# Or restart dev server
npm run dev
Problem: Cannot find module 'xyz'
Solution:
# Reinstall specific package
npm install xyz
# Or reinstall all
npm install
MIT License - feel free to use for personal or commercial projects.
This is a demonstration project, but suggestions are welcome:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
For issues or questions:
- Check Troubleshooting section
- Review console logs in browser DevTools
- Ensure Node.js 18+ is installed
Future enhancements (simulated):
- Dark/Light theme toggle
- Export alerts to CSV/PDF
- More chart types
- Custom alert filters
- Mobile responsive design improvements
- Keyboard shortcuts
- Alert sound notifications
Built with β€οΈ using React, Vite, and TailwindCSS
Perfect for demonstrations, portfolios, and learning modern web development!