bluetape4k workshop
한국어 Design source

SaaS Usage Billing · Interactive Architecture

Turn Usage Events into Correctable Invoices

Compare how a ledger baseline, Event Sourcing, and five microservices preserve the same billing invariants while changing data authority and recovery cost.

Ledger baseline

One PostgreSQL authority preserves deduplication, occurrence-time pricing, resumable closing, an immutable ledger, and invoices.

Final authoritypostgresql-ledger
Scenario to verify
Initial state
Observed result
Allowed follow-up

Invariants that survive each architecture choice

SOURCE_EVENT_DEDUPSource-event deduplication

A business fact is stored once regardless of retry count.

OCCURRED_AT_PRICEOccurrence-time pricing

Select the price interval at usage time, not billing time.

IMMUTABLE_FINANCIAL_FACTImmutable finalized money

Correct finalized amounts with linked records instead of mutation.

RESTART_SAFE_RESULTRestart-safe outcome

Resuming from a checkpoint must converge on the same final result.

LINKED_CORRECTIONLinked correction

Late or incorrect results point back to their original record.