FDRPay is a full-stack federated learning platform for privacy-preserving credit card fraud detection. It leverages Flower, PyTorch, and modern web technologies to enable distributed, secure, and explainable AI on sensitive financial data.
- Federated Learning: Train models across multiple clients without sharing raw data
- Advanced Metrics: Real-time dashboard for AUC, F1, Precision, Recall, Loss, Fraud Rate, and Risk Score Distribution
- Hyperparameter Optimization: Automated tuning with Optuna
- Differential Privacy: Configurable noise addition for privacy
- Modern Frontend: Interactive dashboard and reporting (React, Material-UI, Recharts)
- API Backend: FastAPI server for analytics and dashboard data
- PDF/Excel Reporting: Generate stakeholder-ready analytics reports
- Scalable & Modular: Easily extendable for new features and datasets
+-------------------+ +-------------------+ +-------------------+
| FL Clients | <--> | FL Server | <--> | Metrics/Models |
| (PyTorch, Flower) | | (Flower, PyTorch) | | (Disk) |
+-------------------+ +-------------------+ +-------------------+
| |
v v
+-----------------------------------------------------+
| FastAPI Analytics API |
+-----------------------------------------------------+
|
v
+-----------------------------------------------------+
| React Frontend Dashboard |
+-----------------------------------------------------+
git clone <your-repo-url>
cd FDRPaypython -m venv .venv
# Activate the environment
# On Windows:
.venv\Scripts\activate
# On Unix/Mac:
source .venv/bin/activate
pip install -r requirements.txtpython fl_server.pyset CLIENT_ID=0
python fl_client.py
# Repeat for CLIENT_ID=1,2,3,4 in separate terminalspip install fastapi uvicorn
uvicorn backend.api:app --reloadcd frontend
npm install --legacy-peer-deps
npm run devVisit http://localhost:3000 in your browser.
- Dashboard: Real-time analytics, model metrics, fraud rate, risk score distribution
- Reports: Generate PDF/Excel reports for any date range
- Live Training: Watch metrics update as federated rounds progress
FDRPay/
├── backend/ # FastAPI analytics API
├── data/ # Data files (e.g., creditcard.csv)
├── frontend/ # React dashboard app
├── metrics/ # Metrics JSON files (auto-generated)
├── models/ # Saved PyTorch models
├── fl_client.py # Federated client code
├── fl_server.py # Federated server code
├── requirements.txt # Python dependencies
└── README.md # This file
- Add new metrics: Update
fl_client.pyandbackend/api.py - Add new visualizations: Edit
frontend/src/components/Dashboard/Dashboard.jsx - Change model architecture: Edit the
Netclass infl_client.pyandfl_server.py - Integrate new datasets: Place CSVs in
data/and update data loading logic
- Differential privacy (configurable)
- No raw data leaves client machines
- Ready for SSL/TLS and authentication extensions
MIT License
For questions or contributions, open an issue or pull request on GitHub.