How vaibhav-nhayade/recover-ai works
RecoverAI is a merchant-facing revenue recovery platform: merchants review failed transactions and recovery cases, while the backend scores cases, selects and checks interventions, executes recovery actions, records outcomes, and exposes audit and analytics views. The graph preserves the documented ML pipeline as a distinct capability; sampled code does not establish a runtime connection from that pipeline to backend scoring. Backend wiring is sampled in the recovery workflow and app entry point; frontend API-client wiring and several service integrations are not shown.
Main entry points: main.py FastAPI application · recovery_service.py Recovery orchestrator · database.py Relational database · layout.tsx Web application
Components 29
Merchant experience
- Web application
frontend/src/app/(authenticated)/layout.tsx - Recovery case views
frontend/src/app/(authenticated)/recovery/[caseId]/page.tsx - Case data hook
frontend/src/hooks/useRecoveryCase.ts - Auth guard
frontend/src/components/auth/AuthGuard.tsx
API and records
- FastAPI application
backend/app/main.py - Merchant authentication
backend/app/api/v1/auth.py - Transactions API
backend/app/api/v1/transactions.py - Recovery cases API
backend/app/api/v1/recovery_cases.py - Agent and batch APIs
backend/app/api/v1/recovery_agent.py - Outcome API
backend/app/api/v1/recovery_outcomes.py - Relational database
backend/app/core/database.py
Recovery decisions
- Case eligibility
backend/app/services/recovery_case_service.py - Recovery orchestrator
backend/app/services/recovery_service.py - Recovery scoring
backend/app/services/recovery_scoring.py - Intervention ranking
backend/app/services/intervention_ranker.py - Retry controls
backend/app/services/recovery_retry.py - Recovery messaging
backend/app/services/recovery_message.py - Provider selection
backend/app/services/provider_factory.py - Recovery provider
backend/app/services/recovery_provider.py - Outcome application
backend/app/services/recovery_result.py
Audit and insight
- Audit API
backend/app/api/v1/audit.py - Audit records
backend/app/services/audit_service.py - Analytics API
backend/app/api/v1/analytics.py - Analytics service
backend/app/services/analytics_service.py
ML pipeline
- Model training
ml/training/train_recovery_model.py - Recovery model
ml/models/recovery_model.py - Model inference
ml/inference/predict_recovery.py
Other components
- Merchant
- Recovery provider service
Connections 31
- Merchant → Web application: uses
- Web application → Auth guard: guards pages
- Web application → Recovery case views: presents cases
- Recovery case views → Case data hook: loads details
- Case data hook → FastAPI application: requests data
- FastAPI application → Merchant authentication: mounts routes
- FastAPI application → Transactions API: mounts routes
- FastAPI application → Recovery cases API: mounts routes
- FastAPI application → Agent and batch APIs: mounts routes
- FastAPI application → Outcome API: mounts routes
- FastAPI application → Audit API: mounts routes
- FastAPI application → Analytics API: mounts routes
- Recovery cases API → Case eligibility: delegates
- Case eligibility → Relational database: reads/writes
- Agent and batch APIs → Recovery orchestrator: dispatches
- Recovery orchestrator → Relational database: reads/writes
- Recovery orchestrator → Retry controls: checks retries
- Recovery orchestrator → Recovery scoring: scores transaction
- Recovery orchestrator → Intervention ranking: ranks interventions
- Recovery orchestrator → Recovery messaging: generates message
- Recovery orchestrator → Provider selection: selects provider
- Provider selection → Recovery provider: returns provider
- Recovery provider → Recovery provider service: executes action
- Recovery orchestrator → Outcome application: applies result
- Outcome application → Relational database: persists outcome
- Audit API → Audit records: queries events
- Audit records → Relational database: reads/writes
- Analytics API → Analytics service: delegates
- Analytics service → Relational database: reads records
- Model training → Recovery model: trains
- Model inference → Recovery model: loads model