How zachary-twh/ledger-txn-api works
Double-entry-ledger is a FastAPI bookkeeping API. Users register and authenticate, create accounts, then deposit, withdraw, or transfer funds; the API records balanced ledger entries and supports balance lookup, transaction history, and integrity checks. Authentication, rate limiting, idempotency, currency checks, and cache invalidation are API concerns. Celery Beat schedules reconciliation and exchange-rate fetching as background tasks. The excerpts show API/database/cache and task/database/exchange-rate interactions; queue deployment details and some endpoint internals are documented but not sampled.
Main entry points: main.py FastAPI routes · tasks.py Reconciliation and FX tasks · database.py Database sessions · models.py Ledger data model
Components 15
Ledger API
- FastAPI routes
app/main.py - User authentication
app/main.py - Account management
app/main.py - Money operations
app/main.py - History and integrity
app/main.py
Persistence and cache
- Ledger data model
app/models.py - Database sessions
app/database.py - Account cache
app/redis_client.py
Background processing
- Celery Beat schedule
app/celery_app.py - Reconciliation and FX tasks
app/tasks.py
External services
- PostgreSQL
- Redis
- RabbitMQ broker
- Frankfurter rates API
Other components
- API client
Connections 16
- API client → FastAPI routes: sends requests
README.md - FastAPI routes → User authentication: routes authentication
README.md - FastAPI routes → Account management: routes account actions
README.md - FastAPI routes → Money operations: routes money operations
README.md - FastAPI routes → History and integrity: routes account reads
README.md - FastAPI routes → Database sessions: opens sessions
app/main.py - FastAPI routes → Ledger data model: queries and updates
app/main.py - Database sessions → PostgreSQL: connects to
app/database.py - Ledger data model → Database sessions: uses declarative base
app/models.py - FastAPI routes → Account cache: gets and invalidates
app/main.py - Account cache → Redis: stores cached values
app/redis_client.py - Celery Beat schedule → Reconciliation and FX tasks: schedules tasks
app/celery_app.py - Celery Beat schedule → RabbitMQ broker: uses broker
app/celery_app.py - Reconciliation and FX tasks → Database sessions: opens sessions
app/tasks.py - Reconciliation and FX tasks → Ledger data model: reads and writes records
app/tasks.py - Reconciliation and FX tasks → Frankfurter rates API: fetches exchange rates
app/tasks.py