Skip to content

Backend: Add immutable event store for credit lifecycle (append-only domain_events) #220

@greatest0fallt1me

Description

@greatest0fallt1me

Description

Persist all credit lifecycle domain events (opened, draw requested/confirmed, repay confirmed, defaulted, suspended) in an append-only domain_events table to support replay, reconciliation, and audits.

Requirements and context

  • Must be secure, tested, and documented.
  • Must include idempotency keys / unique constraints to prevent duplicates.

Suggested execution

git checkout -b feature/domain-events-store

Implement changes

  • Add domain_events table with type, payload json, aggregate id, created_at.
  • Write events from service layer (transactionally if using outbox).
  • Tests that assert events are recorded for key operations.
  • Document replay strategy.

Test and commit

npm test

Example commit message

feat(db): append-only domain event store for credit lifecycle

Guidelines

  • Timeframe: 96 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend service/API workcreditCredit domain logicdatabaseDatabase schema/queriesreliabilityResilience, retries, idempotencytestingTests and coverage
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions