The backend creates the state tables during startup with CREATE TABLE IF NOT EXISTS. Existing event, webhook, bandit, and decision tables remain in place.
PostgreSQL is selected through DATABASE_URL; SQLite remains the local fallback
for the legacy demo.
Install backend requirements, including the Psycopg 3 PostgreSQL driver, then set a SQLAlchemy connection URL before starting FastAPI:
$env:DATABASE_URL = "postgresql+psycopg://nummus:password@localhost:5432/nummus"
cd backend
uvicorn main:app --reloadThe backend also normalizes provider URLs beginning with postgres:// or
postgresql:// to the Psycopg 3 SQLAlchemy dialect. Keep credentials in the
deployment environment; do not commit them.
customersstores customer segments and aggregate payment history.paymentsstores payment facts;amountis in major currency units (for example, rupees). Razorpay webhook amounts arrive in minor units and must be converted before a payment row is created.recovery_attemptsstores each planned or executed action, its status, and cost.recovery_outcomesstores the eventual result for an attempt.policiesstores action limits. Cooldowns are represented ascooldown_seconds; costs use major currency units.audit_logsrecords event, decision, actor, reason, and optional links to a payment or attempt.
time_to_recovery_seconds is an integer duration in seconds. The webhook
ingestion endpoint currently writes to webhook_events; connecting those
events to customers and payments is a later workflow step. This schema
creation does not itself populate customer records or trigger recovery actions.