How vinayakak2/ai-invoice-reconciliation-platform works
This is a multi-tenant FastAPI reconciliation platform. Users authenticate into a company workspace, maintain customers and invoices, ingest bank statements, then evaluate payment matches with deterministic rules and evidence scoring. Reconciliation and review are distinct product stages; the graph also shows the API composition and shared database layer. The source index and excerpts establish key router, use-case, and domain dependencies; unsampled subsystems and integrations are represented only where documented, without inferring internal call chains.
Main entry points: v1/router.py API v1 router · dependencies.py JWT and tenant guard · presentation/router.py Invoice management · presentation/router.py Payment and statement APIs
Components 21
API and security
- API v1 router
backend/app/api/v1/router.py - Authentication routes
backend/app/modules/auth/presentation/router.py - JWT and tenant guard
backend/app/modules/auth/presentation/dependencies.py
Workspace management
- Account use cases
backend/app/modules/auth/application/use_cases.py - Company workspace
backend/app/modules/company/domain/entities.py - Customer management
backend/app/modules/customer/presentation/router.py - Customer use cases
backend/app/modules/customer/application/use_cases.py
Financial records
- Invoice management
backend/app/modules/invoice/presentation/router.py - Invoice use cases
backend/app/modules/invoice/application/use_cases.py - Document processing
backend/app/modules/invoice/application/pipeline.py - Payment and statement APIs
backend/app/modules/payment/presentation/router.py - Statement CSV parser
backend/app/modules/payment/application/csv_parser.py - Payment use cases
backend/app/modules/payment/application/use_cases.py
Reconciliation workflow
- Reconciliation APIs
backend/app/modules/reconciliation/presentation/router.py - Reconciliation orchestration
backend/app/modules/reconciliation/application/use_cases.py - Matching rules and evidence
backend/app/modules/reconciliation/domain - Review workflow
backend/app/modules/review/presentation/router.py
Shared platform
- Audit endpoints
backend/app/modules/audit/presentation/router.py - Database sessions
backend/app/core/database.py - Exact money arithmetic
backend/app/shared/domain/money.py
Other components
- Accountant or owner
Connections 29
- Accountant or owner → API v1 router: uses API
backend/app/api/v1/router.py - API v1 router → Authentication routes: registers
backend/app/api/v1/router.py - API v1 router → Customer management: registers
backend/app/api/v1/router.py - API v1 router → Invoice management: registers
backend/app/api/v1/router.py - API v1 router → Payment and statement APIs: registers
backend/app/api/v1/router.py - API v1 router → Reconciliation APIs: registers
backend/app/api/v1/router.py - API v1 router → Review workflow: registers
backend/app/api/v1/router.py - API v1 router → Audit endpoints: registers
backend/app/api/v1/router.py - Authentication routes → Account use cases: invokes
backend/app/modules/auth/presentation/router.py - Authentication routes → JWT and tenant guard: uses guard
backend/app/modules/auth/presentation/router.py - JWT and tenant guard → Database sessions: gets session
backend/app/modules/auth/presentation/dependencies.py - JWT and tenant guard → Company workspace: validates tenant
backend/app/modules/auth/presentation/dependencies.py - Customer management → Customer use cases: invokes
backend/app/modules/customer/presentation/router.py - Customer management → JWT and tenant guard: uses guard
backend/app/modules/customer/presentation/router.py - Invoice management → Invoice use cases: invokes
backend/app/modules/invoice/presentation/router.py - Invoice management → Document processing: retries processing
backend/app/modules/invoice/presentation/router.py - Payment and statement APIs → Payment use cases: invokes
backend/app/modules/payment/presentation/router.py - Payment and statement APIs → Statement CSV parser: imports statements
- Reconciliation APIs → Reconciliation orchestration: invokes
backend/app/modules/reconciliation/presentation/router.py - Reconciliation orchestration → Matching rules and evidence: uses rules
backend/app/modules/reconciliation/application/use_cases.py - Reconciliation APIs → JWT and tenant guard: uses guard
backend/app/modules/reconciliation/presentation/router.py - Invoice management → JWT and tenant guard: uses guard
backend/app/modules/invoice/presentation/router.py - Payment and statement APIs → JWT and tenant guard: uses guard
backend/app/modules/payment/presentation/router.py - Customer management → Database sessions: gets session
backend/app/modules/customer/presentation/router.py - Invoice management → Database sessions: gets session
backend/app/modules/invoice/presentation/router.py - Payment and statement APIs → Database sessions: gets session
backend/app/modules/payment/presentation/router.py - Reconciliation APIs → Database sessions: gets session
backend/app/modules/reconciliation/presentation/router.py - Payment use cases → Exact money arithmetic: uses exact amounts
- Matching rules and evidence → Exact money arithmetic: uses exact amounts