Skip to content
The Auth.js project is now part of Better Auth.
API reference@auth/pouchdb-adapter

@auth/pouchdb-adapter

Official PouchDB adapter for Auth.js / NextAuth.js.

Installation

npm install pouchdb pouchdb-find @auth/pouchdb-adapter

PouchDBAdapterOptions

Configure the adapter

Properties

indexes?

optional indexes: IndexConfig;

Override the default index names.

Default
{  userByEmail: "nextAuthUserByEmail",  accountByProviderId: "nextAuthAccountByProviderId",  sessionByToken: "nextAuthSessionByToken",  verificationTokenByToken: "nextAuthVerificationRequestByToken" }

pouchdb

pouchdb: Database;

Your PouchDB instance, with the pouchdb-find plugin installed.

Example
import PouchDB from "pouchdb"   PouchDB  .plugin(require("pouchdb-adapter-leveldb")) // Or any other adapter  .plugin(require("pouchdb-find")) // Don't forget the `pouchdb-find` plugin   const pouchdb = new PouchDB("auth_db", { adapter: "leveldb" })   #### prefixes?   ```ts optional prefixes: PrefixConfig;

Override the default prefix names.

Default
{  user: "USER",  account: "ACCOUNT",  session: "SESSION",  verificationToken: "VERIFICATION-TOKEN" }

createIndexes()

function createIndexes(pouchdb, indexes?): Promise<void>

Parameters

ParameterType
pouchdbDatabase
indexes?IndexConfig

Returns

Promise<void>


PouchDBAdapter()

function PouchDBAdapter(options): Adapter

Parameters

ParameterType
optionsPouchDBAdapterOptions

Returns

Adapter

Auth.js © Better Auth Inc. - 2025