npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

baileysauth

v1.2.0

Published

Multiple authentication method for Baileys socket Whatsapp bot library

Readme

Lightweight package multiple session and multiple authentication methods for Baileys whatsapp socket library. Supporting SQL and NoSQL databases.

Installation

This package relies on peer dependencies for database drivers. Make sure to install the appropriate driver for your preferred database.
Supported databases:

  • MySQL – requires mysql2
  • PostgreSQL – requires pg
  • MongoDB – requires mongodb

Example Installation

# Using MySQL
npm install baileysauth mysql2

# Using PostgreSQL
npm install baileysauth pg

# Using MongoDB
npm install baileysauth mongodb

After packages installation, now you can import the useBaileysAuthState function to your code

import useBaileysAuthState from 'baileysauth';

How to Use

This package provides two ways to connect to your database using a connection string or using a connection options object,

Using a Connection String

You can establish a connection by passing a valid connection string directly:

const { saveCreds, state } = await useBaileysAuthState(
  "mysql://<username>:<password>@localhost:3306/mydatabase"
);

[!NOTE] Since the release of version v1.2.0 baileysauth has supported custom table name and session name for connection string connect method. Please check the example directory to see how to customize it.

Using Connection Options

Alternatively, you can use an options object for more flexibility. This method allows you to specify the database driver explicitly using the dialect property and pass driver-specific options through the args property.

const { saveCreds, wipeCreds, state } = await useBaileysAuthState({
  dialect: "mysql", // allowed values: mysql, pg, mongodb
  database: MYSQL_DATABASE,
  host: MYSQL_HOST,
  user: MYSQL_USER,
  password: MYSQL_PASSWORD,
  port: MYSQL_PORT,
  session: APP_SESSION,
  table: APP_STORE,
  // Driver-specific options (optional)
  args: {
    // For MySQL (mysql2)
    connectionLimit: 10,
    ssl: { rejectUnauthorized: false },
  },
});

[!NOTE] The args property should contain valid options specific to the selected dialect. Refer connection options below based on your dialect,

If you are still confused, please ask by creating an issue.

Example Usage

For usage examples, you can refer to the example directory. Check it out!

🧩 Contributing

If you have any question or you have an issue when trying to use the package feel free to create an issue or make a pull request to contribute.


Made with ❤️ by Rizky Aulia Tumangger - Copyright All Rights Reserved © 2025