Soft-delete, audit trail, and GDPR compliance for Drizzle ORM. SQLite, PostgreSQL, MySQL.
pnpm add @rafters/ledgerPeer dependency: drizzle-orm >= 0.30.0
Two entry points: @rafters/ledger for the ORM-agnostic core (context, pure helpers, GDPR utilities), and @rafters/ledger/drizzle for the Drizzle adapter (schema, createAuditedDb, query filters, logging). Dialect-specific column definitions live at @rafters/ledger/drizzle/soft-delete/sqlite, /pg, and /mysql.
Full documentation: docs/
| Guide | Covers |
|---|---|
| Getting Started | End-to-end setup walkthrough |
| Soft-Delete | Column helpers, query filters, automatic soft-delete, restore |
| Audit Trail | AuditLogger, manual logging, history queries |
| Context | AsyncLocalStorage propagation, middleware setup |
| GDPR | purgeUserData, PII anonymization, admin preservation |
| Better Auth | ledgerPlugin, createSoftDeleteCallback, flow control |
| API Reference | Every export, every type, organized by subpath |
MIT. Authored by Sean Silvius. Source: github.com/rafters-studio/ledger.