An intelligent fraud detection system for financial transactions using Artificial Intelligence and Machine Learning.
FraudDetect AI is an advanced system that uses Machine Learning algorithms (Random Forest) to analyze financial transactions and detect fraudulent activities with high accuracy. The system provides a comprehensive dashboard with real-time analytics and supports multiple languages.
- π€ Intelligent Fraud Detection using Random Forest ML Model
- π Interactive Dashboard with live charts and analytics
- π CSV File Upload & Analysis with automatic processing
- π Bilingual Support (Arabic & English) with RTL/LTR
- π Dual Theme Mode (Light & Dark)
- π Achievements & Points System for user engagement
- π± Responsive Design works on all devices
- π Real-time Statistics and threat visualization
- π Transaction History with detailed analysis
- Flask 3.0.3 - Web framework
- Werkzeug 3.0.1 - WSGI utility library
- Pandas 2.2.2 - Data manipulation and analysis
- NumPy 1.26.4 - Numerical computing
- Scikit-learn 1.5.0 - Machine Learning algorithms
- Chart.js - Interactive charts
- Font Awesome - Icon library
- Python 3.8 or higher
- pip (Python package manager)
- Git (optional)
- Clone the repository:
git clone https://github.com/labeebnaji/WebApp-with-AI.git
cd frauddetect-ai/Frauddetect-ai-WebApp- Create a virtual environment (recommended):
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate- Install required packages:
pip install -r requirements.txt- Set up environment variables:
# Copy the example file
cp .env.example .env
# Edit .env with your settings- Initialize the database:
python -c "from app import app, init_db; init_db()"- Run the application:
python app.py- Open your browser:
http://127.0.0.1:5000
frauddetect-ai/
βββ app.py # Main application file
βββ schema.sql # Database schema
βββ requirements.txt # Python dependencies
βββ random_forest_model.pkl # ML model (trained)
βββ .env.example # Environment variables template
βββ .gitignore # Git ignore rules
βββ LICENSE # MIT License
βββ README.md # Project documentation
βββ static/ # Static files
β βββ css/
β β βββ style.css # Main stylesheet
β βββ js/
β βββ main.js # JavaScript functionality
βββ templates/ # HTML templates
β βββ base.html # Base template
β βββ index.html # Dashboard page
β βββ upload.html # File upload page
β βββ alerts.html # Alerts & analytics page
β βββ profile.html # User profile page
β βββ achievements.html # Achievements page
β βββ errors/ # Error pages
β βββ 404.html
β βββ 500.html
βββ translations/ # Language files
βββ ar.json # Arabic translations
βββ en.json # English translations
- Navigate to "Upload Data" page
- Upload a CSV file containing transactions
- Click "Run Model" to analyze
- Transactions are automatically analyzed
- Fraudulent transactions appear in red
- Safe transactions appear in green
- View detailed statistics on the dashboard
- Dashboard displays comprehensive statistics
- Interactive charts for threat visualization
- Overall security score indicator
The CSV file must contain the following columns:
cc_num,category,amt,zip,lat,long,city_pop,merch_lat,merch_long,trans_day,trans_month,trans_year,trans_hour,trans_minute
cc_num,category,amt,zip,lat,long,city_pop,merch_lat,merch_long,trans_day,trans_month,trans_year,trans_hour,trans_minute
4532123456789012,grocery,45.50,12345,40.7128,-74.0060,8000000,40.7580,-73.9855,15,1,2025,14,30
6011987654321098,gas_transport,75.20,54321,34.0522,-118.2437,4000000,34.0689,-118.4452,16,1,2025,9,15
cc_num: Credit card numbercategory: Transaction category (grocery, gas_transport, etc.)amt: Transaction amountzip: ZIP codelat,long: Customer location coordinatescity_pop: City populationmerch_lat,merch_long: Merchant location coordinatestrans_day,trans_month,trans_year: Transaction datetrans_hour,trans_minute: Transaction time
- Real-time threat detection statistics
- Monthly comparison charts
- Security score indicator
- Interactive data visualization
- Drag & drop file upload
- Automatic CSV validation
- Batch transaction processing
- Instant fraud detection results
- Comprehensive transaction history
- Fraud/Safe transaction filtering
- Detailed transaction information
- Export capabilities (coming soon)
- Personal information management
- Social media links
- Activity tracking
- Achievement progress
- Threat Finder: Discover your first security threat
- Security Expert: Discover 50+ security threats
- Cybersecurity Master: Master all security modules
FLASK_APP=app.py
FLASK_ENV=development
SECRET_KEY=your-secret-key-here
DATABASE_URL=frauddetect.db
DEBUG=True
HOST=0.0.0.0
PORT=5000
MAX_CONTENT_LENGTH=16777216- β Enable SECRET_KEY in app.py
- β Implement user authentication system
- β Encrypt credit card numbers
- β Add CSRF Protection
- β Use HTTPS
- β Add Rate Limiting
- β Implement proper logging
- β Use production-grade database (PostgreSQL/MySQL)
- β Add input validation and sanitization
- β Implement backup mechanisms
- Use a production WSGI server:
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 app:app- Set environment to production:
FLASK_ENV=production
DEBUG=False-
Use a reverse proxy (Nginx/Apache)
-
Enable HTTPS with SSL certificate
-
Use a production database
# Run tests (when implemented)
python -m pytest tests/
# Check code coverage
python -m pytest --cov=app tests/Contributions are welcome! Please follow these steps:
- Fork the project
- Create your 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.
- Labeeb Al Baqeri - Initial work
- Flask documentation and community
- Scikit-learn for ML algorithms
- Chart.js for beautiful visualizations
- Font Awesome for icons
- All contributors and supporters
For questions or suggestions, please open an issue on GitHub.
Made with β€οΈ using Flask & Python
β Star this repo if you find it useful!


