How risvey-hasan/banking_api works
This is a reliability-focused financial transaction service. Customers and administrators use its HTTP API to sign up or authenticate, inspect accounts and transactions, submit transfers or reversals, and receive accepted work for asynchronous processing. PostgreSQL holds account, session, and transaction state; Redis supports the work queue. Workers apply accepted transactions, while a sweeper supports recovery and redispatch. The excerpts show API routing and several dependency calls; links for unsampled worker and recovery internals are limited to documented behavior or omitted where not established.
Main entry points: db.py Database pool · main.py HTTP API · redis_client.py Redis client · auth.py Auth routes
Components 22
API and identity
- HTTP API
app/main.py - Auth routes
app/api/auth.py - Identity and sessions
app/auth.py - Credential security
app/security.py - API schemas
app/schemas.py
Accounts and ledger
- Account operations
app/api/accounts.py - Account numbers
app/account_number.py - Transaction routes
app/api/transactions.py - Transfer routes
app/api/transfers.py - SQL projections
app/sql.py
Async processing
- Queue worker
app/worker/main.py - Transaction applier
app/worker/apply.py - Recovery sweeper
app/sweeper.py - Queue interface
app/queue.py
Runtime infrastructure
- PostgreSQL
- Redis
- Database pool
app/db.py - Redis client
app/redis_client.py - Configuration
app/config.py - Health and metrics
app/metrics.py
Other components
- Customer
- Administrator
Connections 36
- Customer → HTTP API: submits requests
README.md - Administrator → HTTP API: uses API
README.md - HTTP API → Auth routes: registers routes
app/main.py - HTTP API → Account operations: registers routes
app/main.py - HTTP API → Transaction routes: registers routes
app/main.py - HTTP API → Transfer routes: registers routes
app/main.py - Auth routes → Identity and sessions: creates sessions
app/api/auth.py - Auth routes → Credential security: hashes passwords
app/api/auth.py - Auth routes → Account operations: opens account
app/api/auth.py - Auth routes → Database pool: queries database
app/api/auth.py - Identity and sessions → Credential security: verifies credentials
app/auth.py - Identity and sessions → Database pool: resolves sessions
app/auth.py - Account operations → Account numbers: generates numbers
app/api/accounts.py - Account operations → Database pool: reads and writes
app/api/accounts.py - Transaction routes → Account operations: checks ownership
app/api/transactions.py - Transaction routes → Database pool: accepts transactions
app/api/transactions.py - Transaction routes → Queue interface: nudges worker
app/api/transactions.py - Transfer routes → Account numbers: resolves recipient
app/api/transfers.py - Transfer routes → Database pool: records transfer
app/api/transfers.py - Transfer routes → Queue interface: nudges worker
app/api/transfers.py - Queue worker → Transaction applier: invokes applier
app/worker/main.py - Queue worker → Redis client: consumes queue
app/worker/main.py - Queue worker → Database pool: uses database
app/worker/main.py - Transaction applier → PostgreSQL: applies ledger work
README.md - Queue interface → Redis client: publishes nudges
app/queue.py - Database pool → PostgreSQL: connects to
app/db.py - Redis client → Redis: connects to
app/redis_client.py - Database pool → Configuration: loads settings
app/db.py - Redis client → Configuration: loads settings
app/redis_client.py - HTTP API → Database pool: starts pool
app/main.py - HTTP API → Redis client: starts client
app/main.py - HTTP API → Health and metrics: serves metrics
app/main.py - Health and metrics → Database pool: probes database
app/metrics.py - Health and metrics → Redis client: probes Redis
app/metrics.py - Recovery sweeper → Database pool: scans pending work
app/sweeper.py - Recovery sweeper → Redis client: redispatches work
app/sweeper.py