@luxledger/postgres-adapter
v0.2.0
Published
PostgreSQL persistence adapter for LuxLedger using Drizzle ORM.
Maintainers
Readme
@luxledger/postgres-adapter
Drizzle/PostgreSQL adapter for @luxledger/core.
This package contains infrastructure implementations:
DrizzleLedgerRepository- Drizzle schema and row mappers
- PostgreSQL client factory
luxLedgerDrizzleSchemaPathfor consumerdrizzle.config.tsfiles
It is intentionally tied to Drizzle and Postgres.
PostgreSQL 16 is the supported persistence model.
State-changing repository operations use explicit PostgreSQL transactions. The adapter enforces persistence-level tenant scoping, atomicity, and transaction-reference idempotency required by the repository invariants guide.
Configuration
The client reads these package-owned variables when equivalent constructor options are not passed:
DATABASE_URL(required)DB_POOL_MAX(default10)DB_IDLE_TIMEOUTin seconds (default20)DB_CONNECT_TIMEOUTin seconds (default10)
JWT, rate-limit, bootstrap, port, and shutdown configuration belongs to the host application, not this package. Environment files must be loaded by the host/runtime before createDbClient is called; Node.js does not load .env automatically.
Drizzle config
import { luxLedgerDrizzleSchemaPath } from '@luxledger/postgres-adapter/drizzle-config';
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
schema: ['./src/db/schema.ts', luxLedgerDrizzleSchemaPath],
out: './drizzle',
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
});Apply migrations before starting application code that depends on a newer adapter schema. Package downgrade does not roll back a database; follow the repository upgrade procedure.
Before production use, pin compatible LuxLedger package versions and review the documentation publication checklist.
