How pravinraj213/fraud-engine works
This is a card-transaction fraud scoring and review application. Clients submit transactions; the backend evaluates pluggable rules against prior account history, stores transactions and assessments, and queues high-risk alerts. Reviewers use the React console to inspect flags and record decisions; the console also exposes rule configuration and transaction simulation. The README documents several subsystem relationships not visible in the sampled source; those links cite the README. Some API routes and frontend pages were not sampled, so their internal wiring is not expanded.
Main entry points: api FastAPI routes · client.js API client · repositories Persistence repositories · transaction_service.py Transaction service
Components 23
Ingestion and scoring
- FastAPI routes
backend/app/api - Transaction service
backend/app/services/transaction_service.py - Rule engine
backend/app/engine/engine.py - Detection rules
backend/app/engine/rules - Account history
backend/app/repositories/history.py - Persistence repositories
backend/app/repositories - SQLite database
backend/app/database.py - Fraud records
backend/app/models.py
Review and reporting
- Queue and detail queries
backend/app/services/query_service.py - Review lifecycle
backend/app/services/review_service.py
Alert delivery
- Alert orchestration
backend/app/services/notification_service.py - Notifier selection
backend/app/notifications/factory.py - Amazon SES
backend/app/notifications/ses.py - Log notifier
backend/app/notifications/log.py
Reviewer console
- React console
frontend/src/App.jsx - API client
frontend/src/api/client.js - Review queue
frontend/src/pages/QueuePage.jsx - Transaction review
frontend/src/pages/TransactionPage.jsx - Rules view
frontend/src/pages/RulesPage.jsx - Transaction simulator
frontend/src/pages/SimulatorPage.jsx
Other components
- Simulator / client
- Reviewer
- Amazon SES
Connections 25
- Simulator / client → FastAPI routes: posts transactions
- FastAPI routes → Transaction service: ingests
backend/app/api/transactions.py - Transaction service → Rule engine: evaluates
backend/app/services/transaction_service.py - Rule engine → Detection rules: runs enabled rules
- Transaction service → Account history: reads prior activity
backend/app/services/transaction_service.py - Transaction service → Persistence repositories: stores transaction and verdict
backend/app/services/transaction_service.py - Persistence repositories → SQLite database: persists records
- SQLite database → Fraud records: creates tables for
backend/app/database.py - FastAPI routes → Queue and detail queries: requests queue and details
backend/app/api/transactions.py - FastAPI routes → Review lifecycle: requests review action
backend/app/api/transactions.py - Queue and detail queries → Persistence repositories: queries assessments and alerts
backend/app/services/query_service.py - Review lifecycle → Persistence repositories: records decisions
backend/app/services/review_service.py - FastAPI routes → Alert orchestration: schedules high-risk alert
backend/app/api/transactions.py - Alert orchestration → Persistence repositories: claims and records delivery
backend/app/services/notification_service.py - Alert orchestration → Notifier selection: selects delivery channel
backend/app/services/notification_service.py - Notifier selection → Amazon SES: selects SES
backend/app/notifications/factory.py - Notifier selection → Log notifier: selects log
backend/app/notifications/factory.py - Amazon SES → Amazon SES: sends email
backend/app/notifications/ses.py - Reviewer → React console: uses
- React console → API client: polls system and stats
frontend/src/App.jsx - Review queue → API client: loads queue
frontend/src/pages/QueuePage.jsx - Transaction review → API client: loads transaction
- Rules view → API client: loads rules
- Transaction simulator → API client: submits transactions
- API client → FastAPI routes: calls endpoints