Banking Readiness
CrateStack ships a coherent set of primitives that regulated workloads ask for out of the box. The set is opt-in — adding@@audit to a model, or wrapping
the router in IdempotencyLayer, costs nothing for services that don’t need
the guarantees.
What’s In
The current banking-grade slice covers:- duplicate-execution protection via
IdempotencyLayerbacked bySqlxIdempotencyStore(Postgres) orRedisIdempotencyStore(Redis) - optimistic concurrency via
@version+If-Match/ETaground-tripping - transactional audit log via
@@audit+cratestack_audit+ pluggableAuditSink - explicit transaction isolation via
run_in_isolated_tx+@isolation - per-principal rate limiting via
RateLimitLayer+InMemoryRateLimitStore(single-replica) orRedisRateLimitStore(multi-replica, viacratestack-redis) - soft-delete via
@@soft_delete - forward-only migrations via
Migration+apply_pendingwith checksum drift detection - runtime validators (
@length,@range,@email,@regex,@uri,@iso4217) with PII-safe error messages - Decimal scalar with a choice of two implemented backends —
rust_decimal(default, fixed-precision) orbigdecimal(arbitrary precision) — additive as of 0.8.0, so different dependents in the same build can each pick their own; see Scalars
What’s Not
The track stops short of:- zero-downtime migration generation from schema diffs
- cluster-wide idempotency replication (the chosen store — Postgres primary or Redis primary — is the single source of truth; multi-region active-active needs a coordinated store plugged into the trait)
- signed audit chains / immutable WORM storage
- field-level read masking or write blocking — model-level only
- an HSM-backed signing or key-management abstraction
- a working FIPS-validated crypto provider —
cratestack-pg’scrypto-aws-lc-rsCargo feature is reserved but not implemented: enabling it is a hardcompile_error!, not a working FIPS mode, pending the TLS backend becoming a genuine per-crate choice acrosscratestack-sqlx/cratestack-client-rust(both currently hard-select the non-FIPSringbackend); see issue #334
Adoption Order
Banks typically adopt these in the order risk dictates. A realistic path:- start with
@@auditon every mutating model — gets you the forensic trail before anything else - add
@versionto balances, ledger entries, transfers — protects against lost updates - wrap mutating routes with
IdempotencyLayer— protects against duplicate execution under client retries - switch transfer/settlement procedures to
@isolation("serializable")— closes the read-write skew window - add
RateLimitLayerper principal — caps abuse without code changes per route - switch hard delete to
@@soft_deletewhere retention rules require it
cratestack-pg’s crypto-aws-lc-rs feature isn’t a working FIPS mode yet — see “What’s Not” above.
Read Next
- Idempotency for the duplicate-execution guarantee
- Optimistic locking for
@version+ ETag flow - Audit log for
@@auditand the transactional outbox - Transaction isolation for
run_in_isolated_txand the retry policy - Rate limiting for the per-principal token bucket
- Soft delete for
@@soft_deletesemantics - Migrations for the forward-only runner
- Validators for
@length,@range,@email,@regex,@uri,@iso4217 - Field attributes for
@readonly,@server_only,@pii,@sensitive,@version - Scalars for the Decimal backend selection
- Crypto for the FIPS provider toggle