{"_id":"@bolkauth/adapter-prisma","_rev":"3-19ba9f2263d9b1b877a65bcaebecee78","name":"@bolkauth/adapter-prisma","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@bolkauth/adapter-prisma","version":"0.1.0","license":"MIT","_id":"@bolkauth/adapter-prisma@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":"752f7fb00cbba877f164b2dea532a0919c39fb14","tarball":"https://registry.npmjs.org/@bolkauth/adapter-prisma/-/adapter-prisma-0.1.0.tgz","fileCount":11,"integrity":"sha512-/opstrsQ6k8TPfGKwdvX48x8EbiwwbYiwjSYI/pA1Jhjl2y3XAMbA4bIjeyT69AtsfuWwyEc+2UlvVHD1U2A9w==","signatures":[{"sig":"MEUCIQDn6ILXxEk0spNecH8EbrTodkDkZ9yxTjIXqph5Pxr7dAIgLb8d2wMrfftn/zVa2ZD3GB/Lna1nQC09uYOJSxItGrE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15697},"main":"dist/index.js","_from":"file:bolkauth-adapter-prisma-0.1.0.tgz","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"},"_resolved":"/tmp/58067215ef0329f02abf289abfc26d86/bolkauth-adapter-prisma-0.1.0.tgz","_integrity":"sha512-/opstrsQ6k8TPfGKwdvX48x8EbiwwbYiwjSYI/pA1Jhjl2y3XAMbA4bIjeyT69AtsfuWwyEc+2UlvVHD1U2A9w==","repository":{"url":"git+https://github.com/shrey/clerk.git","type":"git"},"_npmVersion":"10.8.2","description":"Prisma ORM adapter for BolkAuth","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@bolkauth/core":"0.1.0","@prisma/client":"^5.10.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","prisma":"^5.10.0","typescript":"^5.3.3"},"_npmOperationalInternal":{"tmp":"tmp/adapter-prisma_0.1.0_1785510664009_0.8449175907903688","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@bolkauth/adapter-prisma","version":"0.1.1","license":"MIT","_id":"@bolkauth/adapter-prisma@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":"a762f2b2abd3efe6dcedaef42bb1177a8458942b","tarball":"https://registry.npmjs.org/@bolkauth/adapter-prisma/-/adapter-prisma-0.1.1.tgz","fileCount":12,"integrity":"sha512-E7nNBU5NdRzUxCojHleYSc7Zey0sq9OBqSbAbnkA5U8qamQKyaiw66nYF5lKSD0GJcFQ2ehsvqj72rsuNSuZEw==","signatures":[{"sig":"MEUCIQChz1ftgesHB7QRaXZF0iVpd1dtIRaZt9mfJXpl0/DEMgIgI+BOwGDlwVSw9LKtYqnTAzD105B3ZI5vLCDxsx065As=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15802},"main":"dist/index.js","_from":"file:bolkauth-adapter-prisma-0.1.1.tgz","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"},"_resolved":"/tmp/65ee568164b6c69163e8a1acb620ef5d/bolkauth-adapter-prisma-0.1.1.tgz","_integrity":"sha512-E7nNBU5NdRzUxCojHleYSc7Zey0sq9OBqSbAbnkA5U8qamQKyaiw66nYF5lKSD0GJcFQ2ehsvqj72rsuNSuZEw==","repository":{"url":"git+https://github.com/shrey/clerk.git","type":"git"},"_npmVersion":"10.8.2","description":"Prisma ORM adapter for BolkAuth","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@bolkauth/core":"0.2.0","@prisma/client":"^5.10.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","prisma":"^5.10.0","typescript":"^5.3.3"},"_npmOperationalInternal":{"tmp":"tmp/adapter-prisma_0.1.1_1785597492766_0.10792123762832584","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@bolkauth/adapter-prisma","version":"0.1.2","description":"Prisma ORM adapter for BolkAuth","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Shreyvats01/bolkauth.git","directory":"packages/adapter-prisma"},"publishConfig":{"access":"public"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","dependencies":{"@prisma/client":"^5.10.0","@bolkauth/core":"0.2.1"},"devDependencies":{"prisma":"^5.10.0","tsup":"^8.0.0","typescript":"^5.3.3"},"scripts":{"build":"tsup","dev":"tsup --watch"},"_id":"@bolkauth/adapter-prisma@0.1.2","bugs":{"url":"https://github.com/Shreyvats01/bolkauth/issues"},"homepage":"https://github.com/Shreyvats01/bolkauth#readme","_integrity":"sha512-gKB+XhKIGwQubjQVf1buAAWfoWlVMmlOMcFAjvSmyoUBF8RFjTXBIiytga90Xj6VHG0KjjkwlD0b/yJrvLOi2Q==","_resolved":"/tmp/982bea3180c8fc85f8d509c5a39f72d3/bolkauth-adapter-prisma-0.1.2.tgz","_from":"file:bolkauth-adapter-prisma-0.1.2.tgz","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-gKB+XhKIGwQubjQVf1buAAWfoWlVMmlOMcFAjvSmyoUBF8RFjTXBIiytga90Xj6VHG0KjjkwlD0b/yJrvLOi2Q==","shasum":"acf4b5b0a860f9a6d8987c2ad1907b5486dfa8df","tarball":"https://registry.npmjs.org/@bolkauth/adapter-prisma/-/adapter-prisma-0.1.2.tgz","fileCount":13,"unpackedSize":21870,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bolkauth%2fadapter-prisma@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD14fAG0SQv/QD/M2d9KPIXo+LvSLhsWkAzYd81Uh6brwIgXsJjAXAxpwC47JNDzM4MqeMDeiTUUE/1/wbuUlAFG94="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:df0892f9-cfda-45e1-a18f-7149be25516d"}},"directories":{},"maintainers":[{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adapter-prisma_0.1.2_1785611074993_0.9429496021468458"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-31T15:11:03.861Z","modified":"2026-08-01T19:04:35.486Z","0.1.0":"2026-07-31T15:11:04.163Z","0.1.1":"2026-08-01T15:18:12.898Z","0.1.2":"2026-08-01T19:04:35.137Z"},"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-prisma"},"description":"Prisma ORM adapter for BolkAuth","maintainers":[{"name":"shreyvats01","email":"techtechnicalshrey@gmail.com"}],"readme":"# @bolkauth/adapter-prisma\n\n[![npm version](https://img.shields.io/npm/v/@bolkauth/adapter-prisma.svg)](https://www.npmjs.com/package/@bolkauth/adapter-prisma)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nOfficial Prisma ORM adapter for **BolkAuth**. Compatible with PostgreSQL, MySQL, SQLite, and CockroachDB via Prisma Client.\n\n## Features\n\n- 💎 **Prisma Client Support**: Clean integration with standard `@prisma/client`.\n- 🔐 **Token Security**: SHA-256 token hashing for sessions and verification tokens.\n- 📐 **Complete Data Models**: Standardized Prisma models (`AuthUser`, `AuthSession`, `AuthAccount`, `AuthVerificationToken`, `AuthUserMetadata`).\n- 🔄 **Cascade Deletions**: Automatic foreign key cascade cleanup on user deletion.\n- 📦 **Exported Schema Reference**: Exported `schemaPath` constant for programmatic schema loading.\n\n---\n\n## Installation\n\n```bash\nnpm install @bolkauth/adapter-prisma @bolkauth/core @prisma/client\nnpm install -D prisma\n# or\npnpm add @bolkauth/adapter-prisma @bolkauth/core @prisma/client\npnpm add -D prisma\n```\n\n---\n\n## Prisma Schema Configuration\n\nAdd the BolkAuth models to your `prisma/schema.prisma` file:\n\n```prisma\ndatasource db {\n  provider = \"postgresql\"\n  url      = env(\"DATABASE_URL\")\n}\n\ngenerator client {\n  provider = \"prisma-client-js\"\n}\n\nmodel AuthUser {\n  id            String    @id @default(cuid())\n  email         String    @unique\n  emailVerified DateTime?\n  name          String?\n  image         String?\n  password      String?\n  createdAt     DateTime  @default(now())\n  updatedAt     DateTime  @updatedAt\n\n  sessions      AuthSession[]\n  accounts      AuthAccount[]\n  metadata      AuthUserMetadata[]\n}\n\nmodel AuthSession {\n  id        String   @id @default(cuid())\n  userId    String\n  expiresAt DateTime\n  token     String   @unique\n  createdAt DateTime @default(now())\n  updatedAt DateTime @updatedAt\n\n  user      AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)\n}\n\nmodel AuthAccount {\n  id                String   @id @default(cuid())\n  userId            String\n  provider          String\n  providerAccountId String\n  accessToken       String?\n  refreshToken      String?\n  expiresAt         Int?\n  createdAt         DateTime @default(now())\n  updatedAt         DateTime @updatedAt\n\n  user              AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n  @@unique([provider, providerAccountId])\n}\n\nmodel AuthVerificationToken {\n  identifier String\n  token      String\n  expiresAt  DateTime\n  createdAt  DateTime @default(now())\n\n  @@unique([identifier, token])\n}\n\nmodel AuthUserMetadata {\n  userId    String\n  key       String\n  value     String\n  createdAt DateTime @default(now())\n  updatedAt DateTime @updatedAt\n\n  user      AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n  @@id([userId, key])\n}\n```\n\n---\n\n## Migrations & Client Generation\n\nRun Prisma CLI commands to generate the client and apply migrations:\n\n```bash\n# Generate Prisma Client\nnpx prisma generate\n\n# Apply migrations in development\nnpx prisma migrate dev --name init_bolkauth\n\n# Deploy migrations in production / CI\nnpx prisma migrate deploy\n```\n\n---\n\n## Adapter Setup\n\nInitialize the `createPrismaAdapter` with your `PrismaClient` instance:\n\n```typescript\n// lib/auth.ts\nimport { PrismaClient } from \"@prisma/client\";\nimport { createPrismaAdapter } from \"@bolkauth/adapter-prisma\";\nimport { createBolkAuth } from \"@bolkauth/core\";\n\nconst prisma = new PrismaClient();\n\nexport const auth = createBolkAuth({\n  adapter: createPrismaAdapter(prisma),\n  secret: process.env.BOLKAUTH_SECRET!,\n});\n```\n\n---\n\n## API Reference\n\n### `createPrismaAdapter(db: PrismaClient)`\n\nAccepts an initialized `PrismaClient` instance and exposes full CRUD adapter methods for BolkAuth:\n\n- `createUser(user)` / `findUserById(id)` / `findUserByEmail(email)` / `updateUser(id, data)` / `deleteUser(id)`\n- `createSession(session)` / `findSessionByToken(token)` / `updateSession(id, data)` / `deleteSession(id)` / `deleteUserSessions(userId)`\n- `createAccount(account)` / `findAccountByProvider(provider, providerAccountId)`\n- `createVerificationToken(token)` / `findVerificationToken(identifier, token)` / `deleteVerificationToken(identifier, token)`\n- `getUserMetadata(userId, key)` / `updateUserMetadata(userId, key, value)`\n\n### Helper Export: `schemaPath`\n\n```typescript\nimport { schemaPath } from \"@bolkauth/adapter-prisma\";\nconsole.log(schemaPath); // Path to default schema.prisma provided by adapter\n```\n\n---\n\n## License\n\n[MIT](./LICENSE) © BolkAuth\n","readmeFilename":"README.md"}