{"_id":"@bolkauth/adapter-drizzle","_rev":"3-903a96085f866446be1a4bc8871f2381","name":"@bolkauth/adapter-drizzle","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@bolkauth/adapter-drizzle","version":"0.1.0","license":"MIT","_id":"@bolkauth/adapter-drizzle@0.1.0","maintainers":[{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"}],"homepage":"https://github.com/shrey/clerk#readme","bugs":{"url":"https://github.com/shrey/clerk/issues"},"dist":{"shasum":"05edc2be25c0c93a7d9d622489e24a4dd317f5cc","tarball":"https://registry.npmjs.org/@bolkauth/adapter-drizzle/-/adapter-drizzle-0.1.0.tgz","fileCount":11,"integrity":"sha512-WX5pVr3NR51KPP5vuIxYhRMsBgvtgTUFpfw7wW5c0zKP7eWi04MA5IsF7wsk7OP5KpCtW8bK18FNyzuVOr4kWA==","signatures":[{"sig":"MEUCIQDHyQ6lH0iDB6OggJM4AjcZV+HO816XbcjFr61GkPMVqQIgGIii9Q0wYqj7qbn+XyRqST9QtOWhaKmBJmaCofZ2Lbs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71082},"main":"./dist/index.js","_from":"file:bolkauth-adapter-drizzle-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"},"_resolved":"/tmp/86c07a8fb0e5fd3b2a687fc0b575abba/bolkauth-adapter-drizzle-0.1.0.tgz","_integrity":"sha512-WX5pVr3NR51KPP5vuIxYhRMsBgvtgTUFpfw7wW5c0zKP7eWi04MA5IsF7wsk7OP5KpCtW8bK18FNyzuVOr4kWA==","repository":{"url":"git+https://github.com/shrey/clerk.git","type":"git"},"_npmVersion":"10.8.2","description":"Drizzle ORM adapter for BolkAuth","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@bolkauth/core":"0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.3.3"},"peerDependencies":{"drizzle-orm":">=0.29.0"},"_npmOperationalInternal":{"tmp":"tmp/adapter-drizzle_0.1.0_1785510663690_0.3838998041766819","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@bolkauth/adapter-drizzle","version":"0.1.1","license":"MIT","_id":"@bolkauth/adapter-drizzle@0.1.1","maintainers":[{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"}],"homepage":"https://github.com/shrey/clerk#readme","bugs":{"url":"https://github.com/shrey/clerk/issues"},"dist":{"shasum":"a8570051102bea04a0e033bc311f8bb2e0cad4c8","tarball":"https://registry.npmjs.org/@bolkauth/adapter-drizzle/-/adapter-drizzle-0.1.1.tgz","fileCount":12,"integrity":"sha512-tckU1ifdY7Z0a125vfvaiO5jPwwYafwK5QY2jE192O5LQJJ8z8NRSWEiSJ0hdgxEF09sziITOzXNxIe4IusnSA==","signatures":[{"sig":"MEQCIESmqrD1yrbNi/DDlQiQl2G8jHdrmjKsIDA1Ty/XhQC1AiAq/n692sIV7EqWHESTk597yR6PE0WbWjB2VSz1o/Ni3w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71188},"main":"./dist/index.js","_from":"file:bolkauth-adapter-drizzle-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"},"_resolved":"/tmp/544804661b61fde8c04a7484d625a066/bolkauth-adapter-drizzle-0.1.1.tgz","_integrity":"sha512-tckU1ifdY7Z0a125vfvaiO5jPwwYafwK5QY2jE192O5LQJJ8z8NRSWEiSJ0hdgxEF09sziITOzXNxIe4IusnSA==","repository":{"url":"git+https://github.com/shrey/clerk.git","type":"git"},"_npmVersion":"10.8.2","description":"Drizzle ORM adapter for BolkAuth","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@bolkauth/core":"0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.3.3"},"peerDependencies":{"drizzle-orm":">=0.29.0"},"_npmOperationalInternal":{"tmp":"tmp/adapter-drizzle_0.1.1_1785597492706_0.46321145709988687","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@bolkauth/adapter-drizzle","version":"0.1.2","description":"Drizzle ORM adapter for BolkAuth","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Shreyvats01/bolkauth.git","directory":"packages/adapter-drizzle"},"publishConfig":{"access":"public"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"peerDependencies":{"drizzle-orm":">=0.29.0"},"dependencies":{"@bolkauth/core":"0.2.1"},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.3.3"},"scripts":{"build":"tsup","dev":"tsup --watch"},"_id":"@bolkauth/adapter-drizzle@0.1.2","bugs":{"url":"https://github.com/Shreyvats01/bolkauth/issues"},"homepage":"https://github.com/Shreyvats01/bolkauth#readme","_integrity":"sha512-aOiJsJ7oeOkgGLFky5gdh1YEvQHkB89D7I/zYIbTylXJZ73AAxtnlrD8aZ1qyZQPb45gysbk9W4N2JFGwHK91g==","_resolved":"/tmp/55db6e443dd07f81cf6d406f41a1a826/bolkauth-adapter-drizzle-0.1.2.tgz","_from":"file:bolkauth-adapter-drizzle-0.1.2.tgz","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-aOiJsJ7oeOkgGLFky5gdh1YEvQHkB89D7I/zYIbTylXJZ73AAxtnlrD8aZ1qyZQPb45gysbk9W4N2JFGwHK91g==","shasum":"0732944e770d92714cdf83305cbcaf721cfd2b5e","tarball":"https://registry.npmjs.org/@bolkauth/adapter-drizzle/-/adapter-drizzle-0.1.2.tgz","fileCount":13,"unpackedSize":77325,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bolkauth%2fadapter-drizzle@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHb8ebdTYoPhVM03AaDcYKgrC8WYYxRKtyPD66LudAJhAiAT4otmyGkoo2wD4eO4zC5tw/LMPo8zXjFlPDDokbOarA=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:665d7ac7-1c33-458b-8cd2-32dd13779ca2"}},"directories":{},"maintainers":[{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adapter-drizzle_0.1.2_1785611075340_0.6321611738341271"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-31T15:11:03.508Z","modified":"2026-08-01T19:04:35.796Z","0.1.0":"2026-07-31T15:11:03.909Z","0.1.1":"2026-08-01T15:18:12.832Z","0.1.2":"2026-08-01T19:04:35.490Z"},"bugs":{"url":"https://github.com/Shreyvats01/bolkauth/issues"},"license":"MIT","homepage":"https://github.com/Shreyvats01/bolkauth#readme","repository":{"type":"git","url":"git+https://github.com/Shreyvats01/bolkauth.git","directory":"packages/adapter-drizzle"},"description":"Drizzle ORM adapter for BolkAuth","maintainers":[{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"}],"readme":"# @bolkauth/adapter-drizzle\n\n[![npm version](https://img.shields.io/npm/v/@bolkauth/adapter-drizzle.svg)](https://www.npmjs.com/package/@bolkauth/adapter-drizzle)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nOfficial Drizzle ORM PostgreSQL adapter for **BolkAuth**. Provides pre-built schema definitions, session token hashing, metadata storage, and seamless integration with Drizzle Kit.\n\n## Features\n\n- 🗄️ **PostgreSQL Support**: Optimized for PostgreSQL via Drizzle ORM (`drizzle-orm/pg-core`).\n- 🔐 **Token Hashing**: Built-in SHA-256 token hashing for sessions and verification tokens.\n- 📦 **Exported Table Schemas**: Pre-defined PostgreSQL tables (`authUsers`, `authSessions`, `authAccounts`, `authVerificationTokens`, `authUserMetadata`).\n- ⚡ **Connection Pooling**: Native compatibility with `pg`, `postgres.js`, `@neondatabase/serverless`, and `@planetscale/database`.\n- 🛠️ **Drizzle Kit Ready**: Easily run schema migrations and pushes.\n\n---\n\n## Installation\n\n```bash\nnpm install @bolkauth/adapter-drizzle @bolkauth/core drizzle-orm pg\nnpm install -D drizzle-kit @types/pg\n# or\npnpm add @bolkauth/adapter-drizzle @bolkauth/core drizzle-orm pg\npnpm add -D drizzle-kit @types/pg\n```\n\n---\n\n## Database Schema Setup\n\nExport BolkAuth table definitions in your Drizzle schema file (e.g. `db/schema.ts`):\n\n```typescript\n// db/schema.ts\nimport { pgTable, text, timestamp } from \"drizzle-orm/pg-core\";\nexport {\n  authUsers,\n  authAccounts,\n  authSessions,\n  authVerificationTokens,\n  authUserMetadata,\n} from \"@bolkauth/adapter-drizzle\";\n\n// Optionally add your application tables here\nexport const posts = pgTable(\"posts\", {\n  id: text(\"id\").primaryKey(),\n  title: text(\"title\").notNull(),\n  authorId: text(\"author_id\").notNull(),\n});\n```\n\n### Table Definitions Reference\n\nBolkAuth manages 5 PostgreSQL tables in your database:\n\n| Exported Table | Database Table Name | Key Fields | Description |\n| :--- | :--- | :--- | :--- |\n| `authUsers` | `bolkauth_users` | `id`, `email`, `password`, `emailVerified`, `name`, `image` | Stores core user identities and auth credentials. |\n| `authAccounts` | `bolkauth_accounts` | `userId`, `provider`, `providerAccountId`, `access_token` | Stores linked OAuth provider credentials. |\n| `authSessions` | `bolkauth_sessions` | `sessionToken` (SHA-256), `userId`, `expires` | Tracks active authenticated sessions. |\n| `authVerificationTokens` | `bolkauth_verification_tokens` | `identifier`, `token` (SHA-256), `expires` | Password reset and email magic link verification tokens. |\n| `authUserMetadata` | `bolkauth_user_metadata` | `id`, `userId`, `key`, `value` (JSONB) | Key-value store for user metadata & custom settings. |\n\n---\n\n## Adapter Initialization & Connection Pooling\n\nSet up your PostgreSQL database connection pool and initialize `createDrizzleAdapter`:\n\n```typescript\n// db/index.ts\nimport { drizzle } from \"drizzle-orm/node-postgres\";\nimport { Pool } from \"pg\";\nimport { createDrizzleAdapter } from \"@bolkauth/adapter-drizzle\";\nimport { createBolkAuth } from \"@bolkauth/core\";\nimport * as schema from \"./schema\";\n\n// 1. Connection pooling with pg.Pool\nconst pool = new Pool({\n  connectionString: process.env.DATABASE_URL,\n  max: 10,\n  idleTimeoutMillis: 30000,\n});\n\nexport const db = drizzle(pool, { schema });\n\n// 2. Initialize BolkAuth with Drizzle Adapter\nexport const auth = createBolkAuth({\n  adapter: createDrizzleAdapter(db),\n  secret: process.env.BOLKAUTH_SECRET!,\n});\n```\n\n---\n\n## Migrations & Schema Push\n\n### 1. Configure `drizzle.config.ts`\n\n```typescript\n// drizzle.config.ts\nimport { defineConfig } from \"drizzle-kit\";\n\nexport default defineConfig({\n  schema: \"./db/schema.ts\",\n  out: \"./drizzle\",\n  dialect: \"postgresql\",\n  dbCredentials: {\n    url: process.env.DATABASE_URL!,\n  },\n});\n```\n\n### 2. Generate and Apply Migrations\n\n```bash\n# Push schema directly to database (development)\nnpx drizzle-kit push\n\n# Or generate migration files for production\nnpx drizzle-kit generate\nnpx drizzle-kit migrate\n```\n\n---\n\n## API Reference\n\n### `createDrizzleAdapter(db: DrizzleDatabase)`\n\nFactory function returning a full `BolkAuthAdapter` instance.\n\n#### Adapter Methods Implemented:\n\n- **Users**: `createUser`, `findUserById`, `findUserByEmail`, `updateUser`, `deleteUser`\n- **Sessions**: `createSession`, `findSessionByToken`, `updateSession`, `deleteSession`, `deleteUserSessions`\n- **Accounts**: `createAccount`, `findAccountByProvider`\n- **Verification Tokens**: `createVerificationToken`, `findVerificationToken`, `deleteVerificationToken`\n- **Metadata**: `getUserMetadata`, `updateUserMetadata`\n\n---\n\n## License\n\n[MIT](./LICENSE) © BolkAuth\n","readmeFilename":"README.md"}