Socket
Book a DemoInstallSign in
Socket

better-auth-mikro-orm

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-auth-mikro-orm

Mikro ORM Adapter for Better Auth

0.4.3
latest
Source
npmnpm
Version published
Weekly downloads
201
-23.57%
Maintainers
1
Weekly downloads
 
Created
Source

better-auth-mikro-orm

Mikro ORM adapter for Better Auth

CI codecov

Installation

pnpm:

pnpm add better-auth-mikro-orm

npm:

npm i better-auth-mikro-orm

Usage

  • First you'll need to set up Mikro ORM and define the core schema for Better Auth. If you use any plugin - don't forget to check if they have any additional database schema definitions, then define entities you'll need for each plugin.
  • When you finished with the schema definition you can simply pass the result of mikroOrmAdapter call to the database option like this:
import {mikroOrmAdapter} from "better-auth-mikro-orm"
import {betterAuth} from "better-auth"

import {orm} from "./orm.js" // Your Mikro ORM instance

export const auth = betterAuth({
  database: mikroOrmAdapter(orm),

  // Don't forget to disable ID generator if it already managed by Mikro ORM:
  advanced: {
    generateId: false
  }
})

API

mikroOrmAdapter(orm: MikroORM): AdapterInstance

Creates Mikro ORM adapter instance. Note that this adapter does not manage database schema for you, so you can't use it with @better-auth/cli. This means you'll have to manage database schema on your own. Please refer to Better Auth and Mikro ORM documentation on the details.

Returns AdapterInstance function for Better Auth database option.

This function expects a single argument:

  • orm - An instance of MikroORM returned from MikroORM.init or MikroORM.initSync methods.

Keywords

auth

FAQs

Package last updated on 13 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.