@bolkauth/driver-mongodb
v0.1.2
Published
MongoDB driver helper for BolkAuth wrapping MongoClient and @bolkauth/adapter-mongodb
Readme
@bolkauth/driver-mongodb
MongoDB driver factory helper for BolkAuth. Connects via mongodb MongoClient, automatically configures TTL and unique collection indexes, and returns a ready-to-use BolkAuth MongoDB adapter.
Installation
pnpm add @bolkauth/driver-mongodb @bolkauth/adapter-mongodb @bolkauth/core mongodbQuickstart
import { createMongoDriver } from "@bolkauth/driver-mongodb";
import { createBolkAuth } from "@bolkauth/core";
// 1. Connect to MongoDB and set up indexes + adapter in one step
const { client, db, adapter } = await createMongoDriver({
uri: process.env.MONGODB_URI!,
dbName: "my_app_auth",
});
// 2. Initialize BolkAuth engine
export const auth = createBolkAuth({
adapter,
secret: process.env.BOLKAUTH_SECRET!,
});License
MIT © BolkAuth
