A complete full-stack web application designed for real-time and batch fraud detection. The system features a React-based frontend dashboard and a Python/Flask machine learning backend powered by XGBoost and Scikit-learn.
- Flexible Training: Train machine learning models using either synthetic data generation or by uploading your own CSV dataset.
- Real-Time Predictions: Simulate transactions and receive live fraud probability scores through the frontend dashboard.
- Performance Metrics: View detailed model metrics (such as accuracy, precision, and recall) instantly after training.
- React.js (Create React App)
- Axios / Fetch API for backend communication
- Python 3
- Flask & Flask-CORS (REST API)
- XGBoost & Scikit-learn (Machine Learning Pipeline)
- Pandas & NumPy (Data processing)
- Gunicorn (Production WSGI server)
fraud-detection/
├── backend/ # Python Flask server & ML models
│ ├── app.py # Main application entry point
│ ├── requirements.txt# Backend dependencies
│ └── ... # ML generator and predict modules
├── frontend/ # React dashboard UI
│ ├── public/ # Static assets
│ ├── src/ # React source code & API services
│ └── package.json # Frontend dependencies
└── data/ # Local dataset storage (if any)
To run this application locally, you'll need to start both the backend server and the frontend development server in separate terminal windows.
Open a terminal, navigate to the backend directory, and set up a Python virtual environment:
cd backend
# Create a virtual environment
python -m venv venv
# Activate the virtual environment (Windows)
venv\Scripts\activate
# For Mac/Linux use: source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Start the Flask app locally
python app.pyThe backend will now be running on http://127.0.0.1:5000
Open a new terminal window, navigate to the frontend directory, and start the app:
cd frontend
# Install Node modules
npm install
# Start the development server
npm startThe React frontend will open in your browser at http://localhost:3000