@custom-auth/prisma
v1.0.11
Published
Prisma database adapter for @custom-auth.
Maintainers
Readme
@custom-auth/prisma
📦 Ecosystem Packages
- 🔑 Core Engine (@custom-auth/core) — The core framework-agnostic auth engine.
- ⚛️ React SDK (@custom-auth/react) — React hooks and context provider.
- 🌐 Next.js SDK (@custom-auth/nextjs) — Edge-compatible Next.js helpers and middleware.
- 🗄️ Database Adapters:
- ✉️ Email Adapters:
The official Prisma ORM adapter for @custom-auth.
Installation
# Install the core engine, the Prisma adapter, and your chosen email adapter
npm install @custom-auth/core @custom-auth/prisma <your-email-adapter>Quick Start
Pass the Prisma adapter into your core engine initialization.
import { CustomAuth } from '@custom-auth/core';
import { PrismaAdapter } from '@custom-auth/prisma';
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
export const auth = new CustomAuth({
db: new PrismaAdapter(prisma),
// ...other config
});Required Schema
You must add the following models to your schema.prisma file for the core engine to function:
model User {
id String @id @default(cuid())
email String @unique
passwordHash String
name String?
role String @default("user")
emailVerified Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sessions Session[]
}
model Session {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
expiresAt DateTime
createdAt DateTime @default(now())
}Documentation
For full documentation, please visit the Main Repository.
