ClickShield is a modern, user-friendly web application that helps users identify potentially malicious websites and phishing attempts. Built with React and TypeScript, it leverages Google's Safe Browsing API to provide real-time threat analysis and comprehensive security reports.
Real-time Threat Detection: Instant analysis using Google's Safe Browsing APIComprehensive Reports: Detailed security analysis with threat intelligence
Scan History: Track and review previous security scans
SSL Verification: Check website certificate validity
PDF Reports: Export professional security reports
Dark Mode: Modern UI with dark/light theme support
Lightning Fast: Instant results with optimized performance
Responsive Design: Works perfectly on all devices
Accessibility: WCAG compliant with screen reader support
React 18 - Modern React with hooks and concurrent features
TypeScript - Type-safe JavaScript development
Vite - Fast build tool and development server
Tailwind CSS - Utility-first CSS framework
Framer Motion - Smooth animations and transitions
Node.js - JavaScript runtime
Express.js - Web application framework
Google Safe Browsing API - Threat intelligence
Before you begin, ensure you have the following installed:
git clone https://github.com/tbhvishal/ClickShield.git
cd ClickShield# Copy the example environment file
cp .env.example .env
# Edit .env and add your Google Safe Browsing API key
# GOOGLE_SAFE_BROWSING_API_KEY=your_api_key_hereImportant: For local development, ensure your .env file contains:
GOOGLE_SAFE_BROWSING_API_KEY=your_api_key_here
VITE_BACKEND_API_URL=http://localhost:8001Note: Port numbers (8001, 5173) and other non-sensitive configs are defined in config.ts at the root.
npm run verifyThis will check:
- β Node.js version (18+)
- β
.envfile exists and is configured correctly - β All required dependencies are installed
- β Project structure is correct
If all checks pass β , you're ready to go!
npm startThis will:
- Install all dependencies (frontend + backend)
- Build the project
- Start backend server on
http://localhost:8001 - Start frontend dev server on
http://localhost:5173 - Open your browser automatically
For Local Development (.env):
GOOGLE_SAFE_BROWSING_API_KEY=your_api_key_here
VITE_BACKEND_API_URL=http://localhost:8001 # Important: Must be set for local devConfiguration File (config.ts):
- Port numbers (8001, 5173) and other non-sensitive settings
- Committed to version control
- Easy to modify without touching
.env
For Production/Vercel (Vercel Dashboard):
- Set
GOOGLE_SAFE_BROWSING_API_KEYin Vercel environment variables - Leave
VITE_BACKEND_API_URLempty or unset - production uses relative URLs
- Install all dependencies (in CI/CD or cloud build step):
npm run install:all- Build the project for production:
npm run build- This builds the frontend (Vite) to
frontend/dist/and the backend (TypeScript) tobackend/dist/.
-
Configure environment variables in your cloud provider:
- Set
GOOGLE_SAFE_BROWSING_API_KEYin your cloud dashboard - Leave
VITE_BACKEND_API_URLempty (or don't set it)
- Set
-
Deploy:
- Never use
npm startfor production - it's for local development only - Always use
npm run buildfor production builds - Keep one
.envfile in the root directory for all configurations
- Visit Google Cloud Console
- Create a new project or select existing one
- Enable the Safe Browsing API
- Create credentials (API Key)
- Add your API key to the root
.envfile:GOOGLE_SAFE_BROWSING_API_KEY=your_api_key_here
Open your browser and navigate to
http://localhost:5173Enter a URL in the input field
Click "Scan Website" to analyze
Review results and security recommendations
URL Submission: User enters a website URL
API Query: Backend queries Google Safe Browsing API
Analysis: Advanced threat analysis and classification
Report Generation: Comprehensive security report
PDF Export: Optional professional PDF report
| Command | Description |
|---|---|
npm start |
π Install dependencies, build, and start both servers for local development |
npm run verify |
β Verify your setup is configured correctly (recommended before first run) |
npm run dev:backend |
π§ Start only the backend server in development mode |
npm run dev:frontend |
π¨ Start only the frontend server in development mode |
npm run install:all |
π¦ Install dependencies for root, backend, and frontend |
npm run build |
ποΈ Build both frontend and backend for production |
npm run build:backend |
π¨ Build only the backend |
npm run build:frontend |
π Build only the frontend |
npm run start:backend |
|
npm run start:frontend |
π Preview the built frontend |
npm run clean |
π§Ή Remove all node_modules and dist folders |
π‘ Tip: Always run npm run verify after cloning the repository or changing your .env file to ensure everything is configured correctly!
Click to expand project structure
ClickShield/
βββ .env # β οΈ Your local environment config (DO NOT COMMIT)
βββ .env.example # Template for .env
βββ config.ts # Non-sensitive configuration (ports, etc.)
βββ package.json # Root package file
βββ start.js # Development startup script
βββ verify-setup.js # Setup verification script
βββ README.md # This file - complete documentation
βββ backend/ # Backend Express API
β βββ src/
β β βββ server.ts # Server entry point
β β βββ app.ts # Express app configuration
β β βββ api/
β β βββ checkUrl.ts # URL checking API endpoint
β βββ package.json
βββ frontend/ # Frontend React app
βββ src/
β βββ App.tsx # Main app component
β βββ components/ # React components
βββ package.json
π« Blank page or "Cannot connect to server"
- Page title and favicon load but content doesn't appear
- Browser console shows connection errors
- Frontend can't reach backend API
-
Check your
.envfile in the root directoryVITE_BACKEND_API_URL=http://localhost:8001
β οΈ This line MUST be set for local development! -
Verify both servers are running:
# Backend should show: β Backend server running on http://localhost:8001 # Frontend should show: β Local: http://localhost:5173/
-
If still not working, restart:
# Stop all servers (Ctrl+C) # Then run: npm start
π "Google Safe Browsing API key not configured" error
- Get your API key from Google Cloud Console
- Add it to root
.envfile:GOOGLE_SAFE_BROWSING_API_KEY=your_actual_key_here
- Restart the servers
π Works on Vercel but not locally (or vice versa)
Different environment configurations
For Local Development (.env):
GOOGLE_SAFE_BROWSING_API_KEY=your_api_key_here
VITE_BACKEND_API_URL=http://localhost:8001 # β REQUIRED for local!For Production/Vercel (set in Vercel Dashboard):
GOOGLE_SAFE_BROWSING_API_KEY=your_api_key_hereVITE_BACKEND_API_URLshould be EMPTY or not set
Note: Port numbers (8001, 5173) are defined in config.ts - no need to set them in .env.
π¦ "Module not found" or dependency errors
# Clean install everything
npm run clean
npm run install:all
# Or manually:
cd backend && npm install
cd ../frontend && npm install
cd ..
npm installποΈ Build fails or TypeScript errors
# Clean and rebuild
cd backend && rm -rf dist node_modules
npm install
npm run build
cd ../frontend && rm -rf dist node_modules
npm install
npm run buildπ Changes not reflecting after update
# Hard refresh in browser: Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (Mac)
# Or clear Vite cache:
cd frontend
rm -rf node_modules/.vite
npm run devπ³ Docker setup not working
# Make sure .env exists with proper values
cp .env.example .env
# Edit .env with your API key
# Rebuild containers
docker-compose down
docker-compose up --buildβ Quick verification checks
# Windows (PowerShell)
Get-Content .env | Select-String "VITE_BACKEND_API_URL"
# Mac/Linux
cat .env | grep VITE_BACKEND_API_URLExpected output for local dev:
VITE_BACKEND_API_URL=http://localhost:8001
# Check backend
curl http://localhost:8001/check-url
# Should return: {"error":"Invalid or missing URL.",...}- Open browser console (F12)
- Look for this log:
VITE_BACKEND_API_URL: http://localhost:8001 - If it shows
undefined, your.envis not configured correctly
# Windows
netstat -ano | findstr :8001
netstat -ano | findstr :5173
# Mac/Linux
lsof -i :8001
lsof -i :5173π Still having issues?
-
Check the logs:
- Backend logs show in the terminal where you ran
npm start - Frontend logs show in browser console (F12)
- Backend logs show in the terminal where you ran
-
Try a different port: Update
config.tsand.env:config.ts:
backend: 8002, // Changed from 8001
.env:
VITE_BACKEND_API_URL=http://localhost:8002
-
Check firewall/antivirus:
- Allow Node.js through firewall
- Temporarily disable antivirus to test
-
Get help:
- Check GitHub Issues
- Create a new issue with:
- Your OS and Node.js version
- Full error message
- Output of
npm start - Your
.envconfiguration (without API key)
For API implementation details (endpoints, request/response shapes and error handling), see backend/src/api/checkUrl.ts.
We welcome contributions! Please see our Contributing Guidelines for details.
-
git checkout -b feature/amazing-feature
git commit -m 'Add amazing feature'git push origin feature/amazing-featureBug Reports: GitHub Issues
Feature Requests: GitHub Issues
If you find ClickShield helpful, please consider:
Following the developer: @tbhvishal)
Starring the repository
Sharing with others
Contributing to the project
This project is licensed under the MIT License - see the LICENSE file for details.
