{"_id":"@anarchitects/better-auth-typeorm-adapter","_rev":"3-0a50da5cbeea2b6521bed18e9fb8f5c9","name":"@anarchitects/better-auth-typeorm-adapter","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@anarchitects/better-auth-typeorm-adapter","version":"0.1.0","keywords":["better-auth","typeorm","postgresql","adapter","auth"],"license":"MIT","_id":"@anarchitects/better-auth-typeorm-adapter@0.1.0","maintainers":[{"name":"vrxj81","email":"johan@anarchitects.dev"}],"homepage":"https://github.com/anarchitects/anarchitecture-community/tree/main/packages/better-auth/typeorm-adapter#readme","bugs":{"url":"https://github.com/anarchitects/anarchitecture-community/issues"},"nx":{"name":"better-auth-typeorm-adapter","targets":{"test":{"options":{"reportsDirectory":"coverage/packages/better-auth/typeorm-adapter"},"outputs":["{options.reportsDirectory}"],"executor":"@nx/vitest:test"},"test-postgres":{"options":{"cwd":"packages/better-auth/typeorm-adapter","command":"vitest run --config vitest.postgres.config.mts"},"executor":"nx:run-commands"},"test-better-auth":{"options":{"cwd":"packages/better-auth/typeorm-adapter","command":"vitest run --config vitest.better-auth.config.mts"},"executor":"nx:run-commands"}}},"dist":{"shasum":"617470985c7f5dd62d0320ef475388420c60ea31","tarball":"https://registry.npmjs.org/@anarchitects/better-auth-typeorm-adapter/-/better-auth-typeorm-adapter-0.1.0.tgz","fileCount":21,"integrity":"sha512-GUMMAtM2eTtAqkQsf3VuZViXc/vHVN6YlM1GQbx8cnEmWiQ9ltUDfxC5hwYeVdh3SoA2XHyg1SvrdQcWTwWzuQ==","signatures":[{"sig":"MEQCIEMEX2dgSTZYKEQZOe13/bwgmX7Z3fztlg2lix1j8JiLAiAyn7CCQQYQ0WGJD46NU6phpUbs6j675xUvCoUipWIuvA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36315},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","@anarchitecture-community/source":"./src/index.ts"},"./package.json":"./package.json"},"gitHead":"ae3776aeb86361420ed612d4505202338a38e574","_npmUser":{"name":"vrxj81","email":"johan@anarchitects.dev"},"repository":{"url":"git+https://github.com/anarchitects/anarchitecture-community.git","type":"git","directory":"packages/better-auth/typeorm-adapter"},"_npmVersion":"10.9.7","description":"Framework-neutral Better Auth database adapter infrastructure for TypeORM.","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.0.0","typeorm":"^0.3.0","@types/pg":"^8.11.0","better-auth":"^1.0.0","testcontainers":"^10.0.0","@opentelemetry/api":"^1.9.0"},"peerDependencies":{"typeorm":"^0.3.0","better-auth":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/better-auth-typeorm-adapter_0.1.0_1774792479897_0.4740915465268811","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@anarchitects/better-auth-typeorm-adapter","version":"0.1.1","keywords":["better-auth","typeorm","postgresql","adapter","auth"],"license":"Apache-2.0","_id":"@anarchitects/better-auth-typeorm-adapter@0.1.1","maintainers":[{"name":"vrxj81","email":"johan@anarchitects.dev"}],"homepage":"https://github.com/anarchitects/anarchitecture-community/tree/main/packages/better-auth/typeorm-adapter#readme","bugs":{"url":"https://github.com/anarchitects/anarchitecture-community/issues"},"nx":{"name":"better-auth-typeorm-adapter","targets":{"test":{"options":{"reportsDirectory":"coverage/packages/better-auth/typeorm-adapter"},"outputs":["{options.reportsDirectory}"],"executor":"@nx/vitest:test"},"test-postgres":{"options":{"cwd":"packages/better-auth/typeorm-adapter","command":"vitest run --config vitest.postgres.config.mts"},"executor":"nx:run-commands"},"test-better-auth":{"options":{"cwd":"packages/better-auth/typeorm-adapter","command":"vitest run --config vitest.better-auth.config.mts"},"executor":"nx:run-commands"}}},"dist":{"shasum":"e08e6c251758061ee9bd578817072678f230597b","tarball":"https://registry.npmjs.org/@anarchitects/better-auth-typeorm-adapter/-/better-auth-typeorm-adapter-0.1.1.tgz","fileCount":21,"integrity":"sha512-kcgegdDk2g/652wAxSG/u6c/lQBwytzEkHQfgSgR8OxsLSBk9fLh7i459PbX08YpVDPis99I+qplfGT0t0fKuw==","signatures":[{"sig":"MEQCIEAOJX8HsUP4kDt9LXj0MBeQpsHCr+ZB7P3NgkaMgc35AiBICBQPAQqfHZCG92tbebPbKhZpKsTxSyvCEIbBpqc82w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@anarchitects%2fbetter-auth-typeorm-adapter@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":36616},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","@anarchitecture-community/source":"./src/index.ts"},"./package.json":"./package.json"},"gitHead":"d1ead39a693e296f682c9eae2bf0f327d702964a","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:daa35264-2c1f-43e7-a920-ca487b244235"}},"repository":{"url":"git+https://github.com/anarchitects/anarchitecture-community.git","type":"git","directory":"packages/better-auth/typeorm-adapter"},"_npmVersion":"11.13.0","description":"Framework-neutral Better Auth database adapter infrastructure for TypeORM.","directories":{},"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.0.0","typeorm":"^0.3.0","@types/pg":"^8.11.0","better-auth":"^1.0.0","testcontainers":"^10.0.0","@opentelemetry/api":"^1.9.0"},"peerDependencies":{"typeorm":"^0.3.0","better-auth":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/better-auth-typeorm-adapter_0.1.1_1780815184089_0.6352223281907639","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@anarchitects/better-auth-typeorm-adapter","version":"0.2.0","description":"Framework-neutral Better Auth database adapter infrastructure for TypeORM.","license":"Apache-2.0","engines":{"node":">=20"},"type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/anarchitects/anarchitecture-community.git","directory":"packages/better-auth/typeorm-adapter"},"bugs":{"url":"https://github.com/anarchitects/anarchitecture-community/issues"},"homepage":"https://github.com/anarchitects/anarchitecture-community/tree/main/packages/better-auth/typeorm-adapter#readme","keywords":["better-auth","typeorm","postgresql","adapter","auth"],"exports":{"./package.json":"./package.json",".":{"@anarchitecture-community/source":"./src/index.ts","types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"publishConfig":{"access":"public"},"nx":{"name":"better-auth-typeorm-adapter","targets":{"test":{"executor":"@nx/vitest:test","outputs":["{options.reportsDirectory}"],"options":{"reportsDirectory":"coverage/packages/better-auth/typeorm-adapter"}},"test-postgres":{"executor":"nx:run-commands","options":{"cwd":"packages/better-auth/typeorm-adapter","command":"vitest run --config vitest.postgres.config.mts"}},"test-better-auth":{"executor":"nx:run-commands","options":{"cwd":"packages/better-auth/typeorm-adapter","command":"vitest run --config vitest.better-auth.config.mts"}}}},"peerDependencies":{"better-auth":"^1.7.0","typeorm":"^1.0.0"},"devDependencies":{"@opentelemetry/api":"^1.9.0","@types/pg":"^8.11.0","better-auth":"^1.7.0","pg":"^8.0.0","testcontainers":"^10.0.0","typeorm":"^1.0.0"},"gitHead":"3a94ca904fdc3bc723c7f366602f31c2c24504b7","_id":"@anarchitects/better-auth-typeorm-adapter@0.2.0","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-E2sa50oaqlzse1LdPd6AzvsZdSXAACcdraUWtqxElSJKGvdgAM2cfXW/c90Keo3hO6DWQrdIpgduhRmIQwWHSA==","shasum":"c948ec85bad90f82e7487bac891cf4e6f449c69c","tarball":"https://registry.npmjs.org/@anarchitects/better-auth-typeorm-adapter/-/better-auth-typeorm-adapter-0.2.0.tgz","fileCount":21,"unpackedSize":41587,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@anarchitects%2fbetter-auth-typeorm-adapter@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDwyJw7YG564ia7LHMEWg5D5LdoD7p+JIqfHRiMNvSLGgIgDGttSRCxPnR2E4iVmqPwacd/uvu7miSONDvizkHvLIA="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:daa35264-2c1f-43e7-a920-ca487b244235"}},"directories":{},"maintainers":[{"name":"vrxj81","email":"johan@anarchitects.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/better-auth-typeorm-adapter_0.2.0_1787931080677_0.6897739293380645"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-29T13:54:39.832Z","modified":"2026-08-28T15:31:21.170Z","0.1.0":"2026-03-29T13:54:40.064Z","0.1.1":"2026-06-07T06:53:04.224Z","0.2.0":"2026-08-28T15:31:20.810Z"},"bugs":{"url":"https://github.com/anarchitects/anarchitecture-community/issues"},"license":"Apache-2.0","homepage":"https://github.com/anarchitects/anarchitecture-community/tree/main/packages/better-auth/typeorm-adapter#readme","keywords":["better-auth","typeorm","postgresql","adapter","auth"],"repository":{"type":"git","url":"git+https://github.com/anarchitects/anarchitecture-community.git","directory":"packages/better-auth/typeorm-adapter"},"description":"Framework-neutral Better Auth database adapter infrastructure for TypeORM.","maintainers":[{"name":"vrxj81","email":"johan@anarchitects.dev"}],"readme":"# `@anarchitects/better-auth-typeorm-adapter`\n\nFramework-neutral Better Auth database adapter infrastructure for TypeORM.\n\nThis package turns a TypeORM `DataSource` plus a caller-owned model map into a Better Auth database adapter. It is intended for host repositories that want Better Auth persistence over TypeORM without inheriting Nest-specific or app-specific integration code.\n\nLonger wrapper and composition examples live in [`docs/examples/better-auth-typeorm-adapter-composition.md`](../../../docs/examples/better-auth-typeorm-adapter-composition.md).\n\n## Purpose\n\nThis package is responsible for:\n\n- adapting Better Auth database operations onto TypeORM\n- resolving models through a caller-provided `models` map\n- resolving fields through the mapped entity metadata\n- staying framework-neutral so host repos keep their own wrappers\n\nThis package is not responsible for:\n\n- generating or owning your TypeORM migrations\n- reusing arbitrary existing app entities automatically\n- choosing which Better Auth plugins your app enables\n- exporting Nest providers, module wrappers, or repo-local helpers\n\n## v1 Support\n\nThe validated v1 support claim for this package is:\n\n- PostgreSQL only\n- string-shaped IDs at the Better Auth API boundary\n- PostgreSQL UUID-backed persistence\n- JSON support on the supported PostgreSQL scope\n- boolean support on the supported PostgreSQL scope\n- date support on the supported PostgreSQL scope\n- core Better Auth model support through the caller-owned `models` map\n\nThe package validation flow includes:\n\n- `yarn nx lint better-auth-typeorm-adapter`\n- `yarn nx test better-auth-typeorm-adapter`\n- `yarn nx run better-auth-typeorm-adapter:test-postgres`\n- `yarn nx run better-auth-typeorm-adapter:test-better-auth`\n\nDeferred or unsupported for v1:\n\n- numeric IDs\n- arrays\n- non-PostgreSQL database claims\n- broad plugin-by-plugin compatibility claims\n\n## Installation\n\nInstall the adapter plus its required Better Auth and TypeORM dependencies in your host repo:\n\n```bash\nyarn add @anarchitects/better-auth-typeorm-adapter better-auth typeorm pg\n```\n\nThe package currently expects:\n\n- Node.js `>=20`\n- `better-auth` `^1.7.0`\n- `typeorm` `^1.0.0`\n- a PostgreSQL driver such as `pg`\n\nCI permanently validates the lower TypeORM boundary (`1.0.0` on Node.js 20) and\nthe newest release allowed by `^1.0.0` (currently `1.1.0`, on Node.js 24).\n\n## Public API\n\nThe public package surface is intentionally small:\n\n```ts\nimport {\n  createBetterAuthTypeormAdapter,\n  type BetterAuthTypeormAdapterOptions,\n  type BetterAuthTypeormModelMap,\n} from '@anarchitects/better-auth-typeorm-adapter';\n```\n\n```ts\ntype BetterAuthTypeormModelMap = Record<string, EntityTarget<ObjectLiteral>>;\n\ninterface BetterAuthTypeormAdapterOptions {\n  dataSource: DataSource;\n  models: BetterAuthTypeormModelMap;\n  adapterId?: string;\n  adapterName?: string;\n}\n\nfunction createBetterAuthTypeormAdapter(\n  options: BetterAuthTypeormAdapterOptions,\n): BetterAuthOptions['database'];\n```\n\n`adapterId` and `adapterName` are optional metadata overrides. The package defaults remain PostgreSQL-oriented internally.\n\n## Minimal Example\n\nThe example below uses `EntitySchema` to keep the setup framework-neutral and decorator-free. It shows the minimum moving parts:\n\n- a PostgreSQL `DataSource`\n- Better Auth-oriented persistence entities\n- a caller-owned `models` map\n- Better Auth configured with `createBetterAuthTypeormAdapter(...)`\n\n```ts\nimport { betterAuth } from 'better-auth';\nimport { DataSource, EntitySchema } from 'typeorm';\n\nimport { createBetterAuthTypeormAdapter } from '@anarchitects/better-auth-typeorm-adapter';\n\nconst UsersEntity = new EntitySchema({\n  name: 'UsersEntity',\n  tableName: 'users',\n  columns: {\n    id: { type: 'uuid', primary: true, generated: 'uuid' },\n    email: { type: 'varchar', unique: true },\n    name: { type: 'varchar' },\n    emailVerified: { type: 'boolean' },\n    image: { type: 'varchar', nullable: true },\n    createdAt: { type: 'timestamptz' },\n    updatedAt: { type: 'timestamptz' },\n  },\n});\n\nconst AccountsEntity = new EntitySchema({\n  name: 'AccountsEntity',\n  tableName: 'accounts',\n  indices: [\n    {\n      name: 'uq_accounts_issuer_account_id',\n      columns: ['issuer', 'accountId'],\n      unique: true,\n    },\n  ],\n  columns: {\n    id: { type: 'uuid', primary: true, generated: 'uuid' },\n    issuer: { type: 'varchar' },\n    accountId: { type: 'varchar' },\n    providerId: { type: 'varchar' },\n    userId: { type: 'uuid' },\n    accessToken: { type: 'varchar', nullable: true },\n    refreshToken: { type: 'varchar', nullable: true },\n    idToken: { type: 'varchar', nullable: true },\n    accessTokenExpiresAt: { type: 'timestamptz', nullable: true },\n    refreshTokenExpiresAt: { type: 'timestamptz', nullable: true },\n    scope: { type: 'varchar', nullable: true },\n    password: { type: 'varchar', nullable: true },\n    createdAt: { type: 'timestamptz' },\n    updatedAt: { type: 'timestamptz' },\n  },\n});\n\nconst SessionsEntity = new EntitySchema({\n  name: 'SessionsEntity',\n  tableName: 'sessions',\n  columns: {\n    id: { type: 'uuid', primary: true, generated: 'uuid' },\n    userId: { type: 'uuid' },\n    expiresAt: { type: 'timestamptz' },\n    token: { type: 'varchar', unique: true },\n    ipAddress: { type: 'varchar', nullable: true },\n    userAgent: { type: 'varchar', nullable: true },\n    createdAt: { type: 'timestamptz' },\n    updatedAt: { type: 'timestamptz' },\n  },\n});\n\nconst VerificationsEntity = new EntitySchema({\n  name: 'VerificationsEntity',\n  tableName: 'verifications',\n  columns: {\n    id: { type: 'uuid', primary: true, generated: 'uuid' },\n    identifier: { type: 'varchar' },\n    value: { type: 'varchar' },\n    expiresAt: { type: 'timestamptz' },\n    createdAt: { type: 'timestamptz' },\n    updatedAt: { type: 'timestamptz' },\n  },\n});\n\nexport const dataSource = new DataSource({\n  type: 'postgres',\n  url: process.env.DATABASE_URL,\n  entities: [UsersEntity, AccountsEntity, SessionsEntity, VerificationsEntity],\n});\n\nawait dataSource.initialize();\n\nexport const auth = betterAuth({\n  database: createBetterAuthTypeormAdapter({\n    dataSource,\n    models: {\n      users: UsersEntity,\n      accounts: AccountsEntity,\n      sessions: SessionsEntity,\n      verifications: VerificationsEntity,\n    },\n  }),\n  advanced: {\n    database: {\n      generateId: 'uuid',\n    },\n  },\n  user: {\n    modelName: 'users',\n  },\n  account: {\n    modelName: 'accounts',\n  },\n  session: {\n    modelName: 'sessions',\n  },\n  verification: {\n    modelName: 'verifications',\n  },\n});\n```\n\n## `DataSource` Expectations\n\nYour host repository owns the `DataSource`.\n\nRecommended expectations for v1:\n\n- initialize the `DataSource` before Better Auth starts using it\n- register explicit Better Auth persistence entities in that `DataSource`\n- target PostgreSQL\n- prefer UUID-backed primary keys for Better Auth persistence tables\n\nThis package does not create or configure the `DataSource` for you.\n\n## Model Map Expectations\n\nThe adapter is model-map driven.\n\nYou must provide a `models` map that matches the Better Auth model names your configuration uses. In the minimal example above, Better Auth is configured to use plural model names, so the `models` map uses:\n\n- `users`\n- `accounts`\n- `sessions`\n- `verifications`\n\nIf your Better Auth configuration uses singular names or plugin-specific names, the `models` map must match those names instead.\n\nField handling is also explicit:\n\n- Better Auth field names may differ from TypeORM property names\n- the adapter resolves fields through mapped entity metadata\n- customization comes from Better Auth model/field transforms plus the `models` map\n\n## Schema Ownership\n\nThe supported v1 scope assumes Better Auth-oriented tables and entities.\n\nConsumers should model explicit Better Auth persistence entities for the core tables rather than expecting the adapter to map itself onto arbitrary existing application entities automatically.\n\n### `users`\n\n| Field           | Expectation                  |\n| --------------- | ---------------------------- |\n| `id`            | Better Auth-facing user ID   |\n| `email`         | User email                   |\n| `name`          | User display name            |\n| `emailVerified` | Email verification state     |\n| `image`         | User profile image reference |\n| `createdAt`     | Creation timestamp           |\n| `updatedAt`     | Last update timestamp        |\n\n### `accounts`\n\n| Field                   | Expectation                                                         |\n| ----------------------- | ------------------------------------------------------------------- |\n| `id`                    | Better Auth-facing account ID                                       |\n| `issuer`                | Stable identity namespace; `local:credential` for password accounts |\n| `accountId`             | Provider account identifier                                         |\n| `providerId`            | Provider name or identifier                                         |\n| `userId`                | Owning Better Auth user ID                                          |\n| `accessToken`           | Provider access token when applicable                               |\n| `refreshToken`          | Provider refresh token when applicable                              |\n| `idToken`               | Provider ID token when applicable                                   |\n| `accessTokenExpiresAt`  | Access token expiration timestamp when applicable                   |\n| `refreshTokenExpiresAt` | Refresh token expiration timestamp when applicable                  |\n| `scope`                 | Provider scope string when applicable                               |\n| `password`              | Password hash for credential-backed flows when applicable           |\n| `createdAt`             | Creation timestamp                                                  |\n| `updatedAt`             | Last update timestamp                                               |\n\nAccount identity is the unique pair `(issuer, accountId)`, not `providerId` and\n`accountId`. Define a database-level unique constraint for that pair. Better Auth\nuses `local:credential` as the issuer for email/password credential accounts.\n\n### `sessions`\n\n| Field       | Expectation                   |\n| ----------- | ----------------------------- |\n| `id`        | Better Auth-facing session ID |\n| `userId`    | Owning Better Auth user ID    |\n| `expiresAt` | Session expiration timestamp  |\n| `token`     | Session token                 |\n| `ipAddress` | Client IP address when stored |\n| `userAgent` | Client user agent when stored |\n| `createdAt` | Creation timestamp            |\n| `updatedAt` | Last update timestamp         |\n\n### `verifications`\n\n| Field        | Expectation                        |\n| ------------ | ---------------------------------- |\n| `id`         | Better Auth-facing verification ID |\n| `identifier` | Verification subject identifier    |\n| `value`      | Verification token or code value   |\n| `expiresAt`  | Verification expiration timestamp  |\n| `createdAt`  | Creation timestamp                 |\n| `updatedAt`  | Last update timestamp              |\n\n## Migration Ownership\n\nHost repositories own their migrations.\n\nThis package does not:\n\n- generate TypeORM migrations for your application\n- own migration files in your repository\n- decide how your deployment pipeline applies schema changes\n\nBetter Auth CLI behavior for built-in adapters does not automatically become the migration workflow for this community adapter.\n\nIf you use this package, you still need to choose and maintain your own TypeORM migration strategy in your host repository.\n\n### Better Auth 1.7 account migration\n\nBefore enabling Better Auth 1.7, the host must migrate existing account rows in\nthis order:\n\n1. Add `issuer` as nullable.\n2. Backfill every existing account with a verified stable issuer. Credential\n   accounts use `local:credential`; OAuth/OIDC issuers must come from trusted\n   provider data or an explicitly chosen host-owned namespace.\n3. Resolve any duplicate `(issuer, accountId)` pairs.\n4. Make `issuer` `NOT NULL`.\n5. Add the unique constraint on `(issuer, accountId)`.\n\nDo not infer a generic issuer for existing social accounts without validating the\nprovider and tenant semantics. The adapter deliberately does not mutate host-owned\nschemas or perform this backfill.\n\n## TypeORM 1.x compatibility boundary\n\nThe adapter uses only TypeORM 1.x public APIs: `DataSource`, `EntityManager`,\nrepositories, entity metadata, and query builders. It does not import TypeORM\ninternals or use legacy `Connection`, global/named connections, `.connection`, or\nremoved find-option compatibility APIs.\n\nEntitySchema metadata drives every field translation, including differing property\nand database names for select, sort, update, predicates, joins, and PostgreSQL\n`RETURNING` results. The test matrix covers a single primary key, UUIDs, booleans,\nJSONB, nullable values, `timestamptz`, all supported Better Auth operators, explicit\n`IS NULL`/`IS NOT NULL`, partial selection with pagination, repository writes and\nrereads, and root plus manager-scoped transactions.\n\n`consumeOne` and `incrementOne` are implemented as one PostgreSQL statement using a\nlocked, single-row CTE and `RETURNING`. Their full `where` clauses are selectors and\nguards; empty mutation criteria are safe no-ops. Concurrent callers therefore\ncannot consume a verification twice, lose counter increments, or update after a\nguard stops matching.\n\n## Optional Plugin Models\n\nOptional Better Auth plugin models are opt-in through the `models` map.\n\nFor example, if your host application enables passkeys, you can register a plugin-specific model alongside the core models:\n\n```ts\ncreateBetterAuthTypeormAdapter({\n  dataSource,\n  models: {\n    users: UsersEntity,\n    accounts: AccountsEntity,\n    sessions: SessionsEntity,\n    verifications: VerificationsEntity,\n    passkeys: PasskeysEntity,\n  },\n});\n```\n\nThis package does not decide which Better Auth plugins a host application uses, and it does not claim broad plugin-by-plugin certification in v1.\n\n## Wrapper Boundary\n\nThis package is the Better Auth adapter. Host repos still own:\n\n- framework-specific wrappers\n- dependency injection and module wiring\n- application-specific auth services and routes\n- entity registration choices\n- plugin enablement choices\n- migration workflows\n\nShort wrapper/composition examples for Nest-style and DDD-style host repos live in [`docs/examples/better-auth-typeorm-adapter-composition.md`](../../../docs/examples/better-auth-typeorm-adapter-composition.md).\n\n## Limitations\n\nThe current v1 boundary is intentionally narrow:\n\n- PostgreSQL is the only required supported database target\n- Better Auth-facing IDs stay string-shaped at the API boundary\n- PostgreSQL UUID columns are valid and recommended\n- numeric IDs are outside the required v1 support claim\n- arrays are outside the required v1 support claim\n- framework wrappers remain host-repo concerns\n\nThe package is intended to be externally usable without private repo knowledge, but it is still intentionally strict about ownership boundaries.\n\n## License\n\nCopyright © 2026 Optimalist BV and Anarchitects contributors.\n\nLicensed under the Apache License, Version 2.0. See the repository [LICENSE](../../../LICENSE) and [NOTICE](../../../NOTICE) files.\n","readmeFilename":"README.md"}