Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

better-auth-cosmos

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-auth-cosmos

A custom better-auth adapter that integrates with Azure Cosmos DB.

latest
npmnpm
Version
0.0.13
Version published
Weekly downloads
3
-75%
Maintainers
1
Weekly downloads
 
Created
Source

Better Auth Cosmos DB Adapter

This project provides a custom adapter for better-auth that integrates with Azure Cosmos DB. It allows for seamless interaction with the required tables: User, Session, Account, and VerificationToken.

Table of Contents

  • Installation
  • Usage
  • API
  • Contributing
  • License

Installation

To install the adapter, run the following command:

npm install better-auth-cosmos

Usage

To use the adapter, import it into your application and configure it with your Azure Cosmos DB connection string and database name.

import { buildCosmosAdapter } from 'better-auth-cosmos';

export const adapter = buildCosmosAdapter({
    adapterId: 'cosmos-adapter',
    adapterName: 'Cosmos Adapter',
    dbCredentials: {
        connectionString: process.env.COSMOS_DB!
    },
    dbName: process.env.COSMOS_DB_NAME || 'better-auth',
    debugLogs: true,
    usePlural: false,
});

API

I am not supporting custom CosmosClient objects and instead initializing through config. Since this adapter is specific to the better-auth implementation, we really don't care about exposing functionality and can leave the abstraction as-is.

import { betterAuth } from "better-auth";
import { cosmosAdapter } from "../my/code";
 
export const auth = betterAuth({
  database: cosmosAdapter({ ...options })),
});

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes. Run the tests with an instance of cosmos to verify changes.

bun run test

License

This project is licensed under use it, idc.

Keywords

better-auth

FAQs

Package last updated on 20 Aug 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