Specs.
The data-model layer — entity relationships, row-level isolation policies, and strict contracts. The structural decisions made before the first migration runs, defined precisely enough to build from.
10 specs
- Data Model6 invariants
RBAC permission model
Roles, permissions, and tenant-scoped assignments — with authorization sourced only from server-writable state, checked at every boundary, and re-checked on sensitive actions so a revoked role actually takes effect.
- PostgreSQL
- RBAC
- Authorization
- Security Contract4 invariants
Session and token lifecycle contract
How tokens are issued, verified, stored, refreshed, and revoked: short-lived verified access tokens, rotating server-revocable refresh tokens, single-flight refresh, and secrets that never sit in plaintext.
- JWT
- OAuth
- Authentication
- Data Model4 invariants
Offline-first sync and conflict model
Records that live on the device and reconcile with a server: globally-unique IDs, per-record versions, deletes as tombstones, and a deterministic conflict rule — so no acknowledged change is ever silently lost.
- SQLite
- Sync
- Mobile
- Job Contract4 invariants
Async write and job contract
The rules for work moved off the request path: 202 means accepted, not applied; jobs carry identifiers, not hydrated models; every job is idempotent, retried with backoff, and visible when it dies.
- Queues
- Laravel
- Async
- Data Model4 invariants
Append-only audit log model
A tamper-evident record of who did what, when, and to what — append-only, hash-chained, and enforced by the database so the log cannot be quietly edited or deleted after the fact.
- PostgreSQL
- Audit
- Compliance
- Data Model4 invariants
Regulated quantity-limit model
The data model and enforcement contract for a statutory rolling-window purchase limit: a fail-closed control, a boot-time-validated window, and an immutable compliance-decision log that proves every check ran.
- PostgreSQL
- Compliance
- Regulated systems
- API Contract4 invariants
Idempotent webhook ingestion contract
The strict contract for receiving at-least-once webhooks: verify the signature, dedupe on the provider's event ID via an atomic insert, apply the effect in the same transaction, and always answer 2xx once accepted.
- Webhooks
- Idempotency
- Stripe
- Data Model4 invariants
Serialised inventory and stock model
Two representations of the same goods — an aggregate count and individually-tracked units — kept consistent by a single state machine and a database-checkable invariant, so the ledger and the shelf never silently disagree.
- PostgreSQL
- Inventory
- State machines
- Data Model4 invariants
Money and ledger data model
Money as integer minor units, a double-entry ledger whose lines always sum to zero, and the constraints that make “the books don’t balance” a write error instead of a month-end discovery.
- PostgreSQL
- Double-entry
- Financial systems
- Isolation Policy4 invariants
Row-level tenant isolation policy
The single-database isolation model: a mandatory tenant key, a default-deny global scope, an explicit bypass registry, and a database-enforced backstop. Where the request scope dies and what carries the tenant across it.
- PostgreSQL
- Laravel
- Row-Level Security