How fayrd/receipt_logging_backend works
Receipt Logger is a FastAPI backend for mobile receipt capture and financial assistance. Its main workflow authenticates a user or device, accepts receipt images, queues batch scans, extracts validated receipt data with AI, and exposes stored receipts and progress to clients. Separate API branches handle chat, accounts, devices, subscriptions, and deletion. The README documents Redis-backed processing and provider options; unsampled modules are represented at their exact tree paths, with only documented relationships shown. External providers are shown as integrations, not inspected implementations.
Main entry points: identity.py Session identity · main.py FastAPI app · scan.py Scan endpoints · chat.py Chat endpoints
Components 26
API workflows
- FastAPI app
main.py - Scan endpoints
src/API/v1/scan.py - Receipt endpoints
src/API/v1/receipts.py - Chat endpoints
src/API/v1/chat.py - User endpoints
src/API/v1/user.py - Device endpoints
src/API/v1/devices.py - Subscriptions API
src/API/v1/subscriptions.py - Deletion workflow
src/API/web/deletion.py - Health diagnostics
src/API/v1/health.py
Domain services
- Batch worker
src/Queue/queue_worker.py - AI extraction
src/Services/extraction_service.py - Image handling
src/Services/image_service.py - Validated schemas
src/Models/schemas.py - RAG chat service
src/Services/chat_service.py - Quota service
src/Services/quota_service.py
Persistence and security
- Session identity
src/Auth/identity.py - Receipt repository
src/Models/Receipts/receipt_repository.py - User repository
src/Models/Users/user_repository.py - Device repository
src/Models/Devices/device_repository.py - Rate limiting
src/Auth/rate_limiter.py - Supabase client
src/Infrastructure/database.py
External systems
- Redis jobs and OTP
- Supabase PostgreSQL
- AI providers
- Email delivery
src/Services/email_service.py
Other components
- Mobile client
Connections 40
- Mobile client → FastAPI app: sends requests
- FastAPI app → Scan endpoints: mounts routes
main.py - FastAPI app → Receipt endpoints: mounts routes
main.py - FastAPI app → Chat endpoints: mounts routes
main.py - FastAPI app → User endpoints: mounts routes
main.py - FastAPI app → Device endpoints: mounts routes
main.py - FastAPI app → Health diagnostics: mounts routes
main.py - Scan endpoints → Session identity: resolves caller
src/API/v1/scan.py - Receipt endpoints → Session identity: resolves caller
src/API/v1/receipts.py - Chat endpoints → Session identity: resolves caller
src/API/v1/chat.py - User endpoints → Session identity: resolves caller
src/API/v1/user.py - Device endpoints → Session identity: resolves caller
src/API/v1/devices.py - Scan endpoints → Batch worker: enqueues batch
- Batch worker → Redis jobs and OTP: stores job state
- Batch worker → AI extraction: processes images
src/Queue/queue_worker.py - Scan endpoints → AI extraction: parses image
src/API/v1/scan.py - AI extraction → AI providers: requests extraction
- AI extraction → Validated schemas: validates output
src/Services/extraction_service.py - Scan endpoints → Image handling: handles uploads
src/API/v1/scan.py - Scan endpoints → Rate limiting: checks limits
src/API/v1/scan.py - Scan endpoints → Quota service: checks quota
src/API/v1/scan.py - Receipt endpoints → Receipt repository: reads and writes
src/API/v1/receipts.py - Receipt endpoints → Image handling: handles images
src/API/v1/receipts.py - Chat endpoints → RAG chat service: runs queries
src/API/v1/chat.py - Chat endpoints → Receipt repository: loads receipts
- RAG chat service → AI providers: requests responses
- Chat endpoints → Rate limiting: checks limits
src/API/v1/chat.py - Chat endpoints → Quota service: checks quota
src/API/v1/chat.py - User endpoints → User repository: manages accounts
src/API/v1/user.py - User endpoints → Rate limiting: checks limits
src/API/v1/user.py - User endpoints → Email delivery: sends messages
src/API/v1/user.py - Device endpoints → Device repository: manages devices
src/API/v1/devices.py - Device endpoints → User repository: loads account
src/API/v1/devices.py - Device endpoints → Rate limiting: checks limits
src/API/v1/devices.py - Subscriptions API → Session identity: resolves caller
src/API/v1/subscriptions.py - Subscriptions API → User repository: loads account
src/API/v1/subscriptions.py - Deletion workflow → Email delivery: sends notices
src/API/web/deletion.py - Supabase client → Supabase PostgreSQL: creates client
src/Infrastructure/database.py - Session identity → Device repository: looks up device
src/Auth/identity.py - Session identity → User repository: looks up user
src/Auth/identity.py