AI-Powered Real-Time Fraud Detection for Banking & Financial Services
Features β’ Quick Start β’ Documentation β’ API β’ Contributing
TransIntelliFlow is an enterprise-grade fraud detection system that combines Machine Learning, AI-assisted explainability, and realistic simulations to identify fraudulent transactions in real-time for the Banking, Financial Services, and Insurance (BFSI) sector.
π¦ TransIntelliFlow/
β
βββ π backend/ # Python Backend (FastAPI)
β βββ src/
β β βββ preprocessing/ # Data cleaning & feature engineering
β β βββ modeling/ # ML model training & evaluation
β β βββ detection/ # Fraud detection engine
β β βββ api/ # REST API endpoints
β β βββ utils/ # Helper functions
β βββ data/
β β βββ raw/ # Original datasets
β β βββ processed/ # Cleaned datasets
β βββ outputs/
β β βββ models/ # Trained ML models
β β βββ eda_reports/ # Analysis reports
β βββ notebooks/ # Jupyter notebooks
β βββ tests/ # Unit tests
β βββ requirements.txt
β
βββ βοΈ frontend/ # React Frontend
β βββ src/
β β βββ components/ # React components
β β βββ services/ # API integration
β β βββ pages/ # Application pages
β βββ public/ # Static assets
β βββ package.json
β
βββ π docs/ # Documentation
- π Data Preprocessing Pipeline - Automated data cleaning and transformation
- π Comprehensive EDA - 8+ visualization reports with insights
- π€ Multiple ML Models - XGBoost, Random Forest with hyperparameter tuning
- β‘ Real-time Detection - Sub-second fraud prediction
- π― Risk Scoring - Multi-factor risk assessment (Low/Medium/High/Critical)
- π¨ Smart Alerting - Automated alerts for suspicious transactions
- π‘ RESTful API - 6+ endpoints for seamless integration
- πΎ Model Persistence - Save and load trained models
- π Transaction Form - Easy transaction submission
- π¨ Real-time Dashboard - Live fraud detection results
- π Metrics Visualization - Model performance charts
- π Transaction History - Searchable transaction log
- π― Risk Indicators - Visual risk level display
- π± Responsive Design - Works on all devices
β οΈ Alert System - Real-time fraud notifications- π§ Email Alert Simulation - Automated security alerts for high-risk transactions with recipient tracking
- π§ͺ Simulation Lab Overlay - Blend the last 500 simulation transactions into the dashboard without disturbing the curated baseline dataset
- π€ Modeling Workspace AI - Gemini explains model metrics and per-transaction predictions directly inside the app
- π¬ Feedback Loop - Mark predictions as correct/incorrect for model improvement
- π Dark Mode - Full dark mode support across all screens
- Open the Simulation Lab screen in the frontend and submit a batch (default 100 transactions).
- FastAPI processes every transaction with the real model, applies realistic heuristics (9β15% fraud), and stores the last 500 results in an in-memory overlay buffer.
- The dashboard can optionally overlay this buffer to showcase live spikes while the baseline 200 curated transactions stay unchanged.
- Backend endpoints involved:
POST /api/simulation/batchGET /api/simulation/overlay
- Ensure
GEMINI_API_KEYis present in the backend.env(see Environment variables). - The Modeling Workspace calls
GET /api/modeling/explainfor global summaries andPOST /api/modeling/predict/explainfor transaction-level narratives. - Responses always include fallback text so the UI never breaks if the external API is unavailable.
- Python 3.11+
- Node.js 18+
- Git
# Clone repository
git clone https://github.com/RaviTeja799/Infosys-springboard-project.git
cd Infosys-springboard-project
# Navigate to backend
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run API server
uvicorn src.api.main:app --reloadCreate a .env file inside backend/ (or export the values in your shell) before starting uvicorn:
USE_MOCK_DATA=true # serves cached Indian mock data when MongoDB is empty
GEMINI_API_KEY=your-google-key # enables AI explanations in Modeling Workspace
GEMINI_MODEL=gemini-1.5-flash # optional override; defaults to gemini-1.5-flashTip: leave
USE_MOCK_DATA=truefor demos so the React dashboard always receives consistent Indian locations/channels. Toggle it off when connecting to a real MongoDB instance.
Backend will run on: http://localhost:8000
API Documentation: http://localhost:8000/docs
# Navigate to frontend (from project root)
cd frontend
# Install dependencies
npm install
# Start development server
npm run devFrontend will run on: http://localhost:5173
POST /api/auth/register # Register new user
POST /api/auth/login # Login user
GET /api/auth/me # Get current userPOST /api/predict # Predict single transaction
POST /api/batch-predict # Predict multiple transactions
GET /api/transactions # Get transaction history
GET /api/metrics # Get model performance metricsRequest:
curl -X POST "http://localhost:8000/api/predict" \
-H "Content-Type: application/json" \
-d '{
"transaction_id": "T1001",
"customer_id": "C123",
"amount": 5000,
"channel": "online",
"timestamp": "2024-01-15T10:30:00",
"account_age_days": 365,
"kyc_verified": true
}'Response:
{
"transaction_id": "T1001",
"prediction": "Fraud",
"risk_score": 0.85,
"risk_level": "High",
"confidence": 0.95,
"alerts": [
"High transaction amount: $5000",
"Suspicious hour: 22:00"
]
}| Module | Timeline | Status | Description |
|---|---|---|---|
| Module 1 | Weeks 1-2 | β Complete | Data Collection & Preprocessing |
| Module 2 | Weeks 3-4 | β Complete | Predictive Transaction Modeling |
| Module 3 | Weeks 5-6 | β Complete | Real-Time Fraud Detection Engine |
| Module 4 | Weeks 7-8 | β Complete | Deployment & Integration |
- Data loading and validation
- Missing value handling
- Feature engineering (temporal, amount-based)
- Data splitting (70/15/15)
- Exploratory Data Analysis (EDA)
- Data quality checks
- Model training (XGBoost, Random Forest)
- Hyperparameter tuning
- Performance evaluation (Accuracy, Precision, Recall, F1, AUC)
- Model persistence and versioning
- Feature importance analysis
- FastAPI-based detection system
- Real-time transaction analysis
- Risk scoring engine
- Alert generation system
- Email notification simulation
- Fraud signature matching
- Behavioral deviation analysis
- FastAPI REST API deployment
- React dashboard with TypeScript
- MongoDB Atlas integration
- Gemini AI integration
- API documentation (Swagger/OpenAPI)
- System health monitoring
- Production-ready configuration
| Category | Technology |
|---|---|
| Language | Python 3.11+ |
| Framework | FastAPI |
| ML/AI | Scikit-learn, XGBoost, Pandas, NumPy |
| Visualization | Matplotlib, Seaborn |
| Database | MongoDB |
| Authentication | JWT (JSON Web Tokens) |
| Testing | Pytest |
| API Docs | Swagger/OpenAPI |
| Category | Technology |
|---|---|
| Framework | React 18+ with TypeScript |
| Build Tool | Vite |
| Styling | TailwindCSS |
| UI Components | Shadcn/ui |
| State Management | Zustand / Redux |
| Data Fetching | React Query, Axios |
| Charts | Recharts, Chart.js |
| Routing | React Router v6 |
cd backend
# Run all tests
pytest tests/
# Run with coverage
pytest --cov=src tests/
# Run specific test file
pytest tests/test_preprocessing.pycd frontend
# Run tests
npm test
# Run with coverage
npm run test:coverage| Document | Description |
|---|---|
| Backend README | Backend setup and API details |
| Frontend README | Frontend setup and components |
| Project Structure | Detailed project organization |
| Quick Start Guide | Get started in 5 minutes |
| API Documentation | Interactive API docs (when running) |
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a 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
- Follow PEP 8 for Python code
- Use ESLint for JavaScript/TypeScript
- Write tests for new features
- Update documentation
- Keep commits atomic and descriptive
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 TransIntelliFlow
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This project is part of the Infosys Virtual Internship - BFSI Track.
| Role | Responsibilities |
|---|---|
| Backend Team | Data preprocessing, ML modeling, API development |
| Frontend Team | React dashboard, UI/UX, API integration |
| ML Team | Model training, evaluation, optimization |
- Infosys Springboard - For the virtual internship opportunity
- BFSI Sector - For real-world problem inspiration
- Open Source Community - For amazing tools and libraries