Complete guide to download, setup, and run the Hawkins Fraud Detection System on your local machine.
Hawkins Fraud Detection System is a Next.js TypeScript application with Supabase backend integration featuring:
- Real-time fraud detection and analytics
- WhatsApp-based transaction approval system
- Customer and corporate dashboards
- AI-powered fraud reasoning
- Secure authentication and authorization
Before starting, ensure you have the following installed:
- Node.js: v18.x or higher (Download)
- npm: v9.x or higher (comes with Node.js)
- Git: Latest version (Download)
- Code Editor: VS Code recommended (Download)
node --version # Should show v18.x or higher
npm --version # Should show v9.x or higher
git --version # Should show git version- Navigate to your project repository
- Click Code β Download ZIP
- Extract the ZIP file to your desired location
- Open terminal/command prompt in the extracted folder
git clone <your-repository-url>
cd hawkins-fraud-detectionNavigate to the project root directory and install all required packages:
# Install all npm dependencies
npm install
# This will install:
# - Next.js 14.2.0
# - React 18.2.0
# - TypeScript
# - Tailwind CSS
# - Supabase client
# - All other dependencies from package.jsonExpected output:
added 342 packages, and audited 343 packages in 45s
Copy the example environment file:
# Create .env.local file in project root
cp .env .env.localGet your Supabase credentials:
- Go to Supabase Dashboard
- Select your project (or create new one)
- Navigate to Settings β API
- Copy the following values:
Update .env.local file:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here
# Optional: Twilio WhatsApp Integration
TWILIO_ACCOUNT_SID=your-twilio-account-sid
TWILIO_AUTH_TOKEN=your-twilio-auth-token
TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL |
β Yes | Your Supabase project URL |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
β Yes | Supabase anonymous/public key |
TWILIO_ACCOUNT_SID |
β No | Twilio Account SID (for WhatsApp) |
TWILIO_AUTH_TOKEN |
β No | Twilio Auth Token (for WhatsApp) |
TWILIO_WHATSAPP_NUMBER |
β No | Twilio WhatsApp number |
Note: WhatsApp integration is optional. The app will work without it, but WhatsApp approval features will be disabled.
The project includes SQL migration files to set up your database schema:
Option A: Via Supabase Dashboard (Recommended)
- Go to Supabase Dashboard β SQL Editor
- Open
supabase/migrations/20251204173053_create_whatsapp_approvals.sql - Copy the entire SQL content
- Paste into SQL Editor and click Run
Option B: Via Supabase CLI
# Install Supabase CLI (if not installed)
npm install -g supabase
# Login to Supabase
supabase login
# Link your project
supabase link --project-ref your-project-ref
# Run migrations
supabase db pushThe migration creates the following tables:
whatsapp_approvals- WhatsApp approval trackingtransactions- Transaction recordsusers- User authenticationfraud_scores- ML fraud detection scores
npm run devExpected output:
> hawkins-fraud-detection@0.1.0 dev
> next dev
- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- event compiled client and server successfully in 2.5s (502 modules)
Open your browser and navigate to:
http://localhost:3000
Available Routes:
/login- Login page/customer-dashboard- Customer view/corporate-dashboard- Corporate/admin view/transaction-review- Transaction review interface/fraud-analytics- Fraud analytics dashboard/transaction-submission- Submit new transactions
- Go to Supabase Dashboard β Authentication β Providers
- Enable Email provider
- Configure email templates (optional)
-- Run in Supabase SQL Editor
INSERT INTO auth.users (email, encrypted_password, email_confirmed_at)
VALUES (
'test@example.com',
crypt('password123', gen_salt('bf')),
NOW()
);- Twilio account (Sign up)
- WhatsApp Business API access
Follow the detailed guide in TWILIO_SETUP_GUIDE.md
Quick Setup:
- Get Twilio credentials from console.twilio.com
- Add credentials to
.env.local - Deploy Supabase Edge Functions:
supabase functions deploy send-whatsapp-approval
supabase functions deploy check-whatsapp-approval
supabase functions deploy whatsapp-webhook# Solution 1: Kill the process using port 3000
npx kill-port 3000
# Solution 2: Use a different port
npm run dev -- -p 3001Error: Invalid Supabase URL or key
Solution:
- Verify
.env.localhas correct credentials - Check Supabase project is active
- Ensure no extra spaces in environment variables
- Restart development server after changing
.env.local
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install# Rebuild TypeScript
npm run build# Verify tailwind.config.js exists
# Restart dev server
npm run devhawkins-fraud-detection/
βββ public/ # Static assets
β βββ assets/images/ # Image files
β βββ favicon.ico # Site favicon
βββ src/
β βββ app/ # Next.js app directory
β β βββ api/ # API routes
β β βββ login/ # Login page
β β βββ customer-dashboard/ # Customer dashboard
β β βββ corporate-dashboard/ # Corporate dashboard
β β βββ fraud-analytics/ # Analytics page
β β βββ transaction-review/ # Review interface
β β βββ transaction-submission/ # Transaction form
β βββ components/ # Reusable components
β β βββ ui/ # UI components
β β βββ common/ # Shared components
β βββ contexts/ # React contexts
β βββ lib/ # Library configurations
β βββ styles/ # Global styles
β βββ utils/ # Utility functions
βββ supabase/
β βββ functions/ # Edge functions
β βββ migrations/ # Database migrations
βββ .env.local # Environment variables (create this)
βββ next.config.mjs # Next.js configuration
βββ package.json # Dependencies
βββ tailwind.config.js # Tailwind configuration
βββ tsconfig.json # TypeScript configuration
# Development
npm run dev # Start development server on localhost:3000
# Production Build
npm run build # Create optimized production build
npm run start # Start production server
# Code Quality
npm run lint # Run ESLint for code quality checks
# Type Checking
npx tsc --noEmit # Check TypeScript types without emitting files- Navigate to
http://localhost:3000/login - Enter test credentials
- Should redirect to dashboard
- Navigate to
http://localhost:3000/customer-dashboard - Submit a quick transaction
- View transaction history
- Submit transaction requiring approval
- Check WhatsApp for approval message
- Reply "Yes it's me" to approve
- Navigate to
http://localhost:3000/fraud-analytics - View fraud trend charts
- Check model performance metrics
- Hot Module Replacement (HMR) enabled
- Fast Refresh for React components
- Source maps for debugging
# Build for production
npm run build
# This will:
# - Optimize JavaScript bundles
# - Minify CSS and HTML
# - Generate static assets
# - Create optimized images- β
Never commit
.env.localto Git - β Use strong Supabase RLS policies
- β Rotate API keys regularly
- β Use HTTPS in production
- β Enable email verification
- β Implement rate limiting
- β Use secure session management
- β Enable MFA for admin accounts
- Twilio Setup: See
TWILIO_SETUP_GUIDE.md - API Documentation: See
API_REFERENCE.md(if available) - Deployment Guide: See
DEPLOYMENT.md(if available)
- Next.js Documentation: https://nextjs.org/docs
- Supabase Documentation: https://supabase.com/docs
- TypeScript Documentation: https://www.typescriptlang.org/docs
- Tailwind CSS Documentation: https://tailwindcss.com/docs
- GitHub Issues (if project is on GitHub)
- Stack Overflow (tag: nextjs, supabase, typescript)
- Supabase Discord Community
Before considering setup complete, verify:
- Node.js and npm installed correctly
- Project dependencies installed successfully
-
.env.localfile created with valid credentials - Supabase database migrations applied
- Development server starts without errors
- Application loads at
http://localhost:3000 - Login functionality works
- Customer dashboard accessible
- No console errors in browser
- Tailwind CSS styling appears correctly
- TypeScript compilation successful
Your Hawkins Fraud Detection System is now running locally!
Next Steps:
- Explore different dashboards and features
- Configure WhatsApp integration (optional)
- Customize styling and branding
- Add custom fraud detection rules
- Deploy to production (Vercel recommended)
When ready to deploy:
# Create optimized production build
npm run build
# Test production build locally
npm run start
# Deploy to Vercel (recommended)
npm install -g vercel
vercelTo update dependencies:
# Check for outdated packages
npm outdated
# Update all packages to latest compatible versions
npm update
# Update to latest major versions (careful!)
npx npm-check-updates -u
npm installLast Updated: December 4, 2025 Version: 1.0.0 Minimum Node Version: 18.x