Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference@auth/typeorm-adapter

@auth/typeorm-adapter

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

Installation

npm install @auth/typeorm-adapter typeorm

TypeORMAdapterOptions

This is the interface for the TypeORM adapter options.

Properties

entities?

optional entities: entities;

The TypeORM entities to create the database tables from.


Entities

type Entities = typeof entities;

entities

const entities: entities = defaultEntities;

getManager()

function getManager(options): Promise<EntityManager>

Parameters

ParameterType
options{ dataSource: string | DataSourceOptions; entities: entities; }
options.dataSourcestring | DataSourceOptions
options.entitiesentities

Returns

Promise<EntityManager>


TypeORMAdapter()

function TypeORMAdapter(dataSource, options?): Adapter

Parameters

ParameterType
dataSourcestring | DataSourceOptions
options?TypeORMAdapterOptions

Returns

Adapter

Auth.js © Balázs Orbán and Team - 2025