About FraudTrace AI
The Inspiration
Fraud rarely tells its whole story through a single transaction. A payment that looks unusual on its own might be connected to several other transactions, accounts, or invoices. We wanted to explore a simple question: What if investigators could see the bigger picture instead of examining suspicious payments one by one?
That question inspired us to build FraudTrace AI, an explainable fraud intelligence platform designed to help investigators identify suspicious activity, discover hidden connections, and make better-informed decisions.
Our goal was not simply to build another system that labels transactions as fraudulent. We wanted to understand why something looks suspicious and give investigators useful evidence they can examine.
What We Built
We developed FraudTrace AI as a full-stack application with several connected investigation capabilities:
- Explainable Fraud Detection: A rule-based engine examines transaction patterns such as unusual amounts, transaction velocity, and new recipients. Every risk score is supported by identifiable evidence rather than being presented as an unexplained number.
- Fraud Network Intelligence: Using NetworkX, we represent accounts and transactions as a network to identify patterns such as shared receivers and rapid movement of funds.
- Invoice Investigation: Users can upload invoices for text extraction and checks for duplicate invoice numbers, missing information, and arithmetic inconsistencies.
- ML Anomaly Detection: An experimental Isolation Forest model identifies unusual transaction behaviour based on historical patterns. Its output is kept separate from the deterministic risk score.
- AI Investigation Assistant: An assistant powered by Gemini, with Groq as an optional fallback, helps investigators understand findings, explore connections, and get evidence-based investigation suggestions.
- PayPal Sandbox Integration: We integrated PayPal Orders v2 to demonstrate checkout approval, payment capture, and automatic transaction analysis after a successful capture.
The application brings these capabilities together in one investigation dashboard. Importantly, its findings are intended to support human investigation, not automatically declare someone guilty of fraud.
How We Built It
We built FraudTrace AI as a modular full-stack application.
The backend uses Python, FastAPI, SQLAlchemy, and SQLite to manage transactions, investigations, evidence, invoices, and payment records. We implemented the initial fraud detection logic as a deterministic rules engine so that every decision could be traced back to specific conditions.
For network analysis, we used NetworkX to model relationships between accounts and transactions. We added scikit-learn's Isolation Forest for experimental anomaly detection, keeping its output independent of the primary risk-scoring system.
The frontend was developed using React, TypeScript, Vite, and Tailwind CSS, with an interactive dashboard for transaction analysis, investigation details, network exploration, invoice checks, and AI-assisted investigation.
For payment integration, we used the PayPal Sandbox REST API. We also integrated Gemini and an optional Groq fallback for the investigation assistant. Before sending investigation context to an external AI provider, we designed a sanitization layer to pseudonymize account and vendor identifiers and remove sensitive information.
Challenges We Faced
One of our biggest challenges was bringing several different technologies together while keeping their responsibilities separate.
Making fraud detection explainable: A high score alone is not useful to an investigator. We had to design rules that produce traceable evidence and distinguish suspicious patterns from confirmed fraud.
Connecting transaction and network intelligence: Detecting individual anomalies was only part of the problem. We also needed to preserve transaction relationships and identify patterns across multiple accounts without treating every connection as proof of wrongdoing.
Handling external API reliability: During AI integration, Gemini requests experienced upstream errors and timeouts. We implemented an optional Groq fallback while ensuring that provider failures did not silently become fabricated investigation results.
PayPal Sandbox integration: Implementing the complete order lifecycle required handling OAuth authentication, order approval, capture, currency validation, and duplicate-capture protection. We successfully tested a Sandbox payment through approval and capture, then verified that repeating the capture did not create another transaction.
Working with incomplete documents and data: Text extraction is not the same as understanding every document. For scanned invoices, OCR depends on an external Tesseract installation, so the application explicitly reports when OCR is unavailable instead of inventing extracted information.
What We Learned
This project taught us that building a useful fraud investigation system involves much more than implementing a machine learning model.
We learned how to design REST APIs, structure a backend, manage relational data, integrate external services, work with graph algorithms, experiment with anomaly detection, and build an interactive frontend.
More importantly, we learned why explainability, data privacy, idempotency, error handling, and responsible AI matter in financial applications. A model's output is not proof, an anomaly score is not a probability, and an AI-generated explanation must remain grounded in available evidence.
FraudTrace AI is our attempt to bring these ideas together: not just detecting suspicious transactions, but helping investigators understand the connections and evidence behind them.
This is a working prototype, and there is still room to improve it with real-world datasets, broader document support, additional payment integrations, and more extensive evaluation.
Built With
- gemini-api
- groq
- networkx
- oauth2.0
- paypal
- pymupdf
- python
- react
- scikit-learn
- sqlalchemy
- sqlite
- tailwindcss
- typescript