An adapter for @whiskeysockets/baileys that stores WhatsApp authentication state in MySQL or MongoDB. Version 1.0.1 provides automatic configuration via .env file, supports multiple sessions per database, and returns { state, saveCreds, db }. Released under MIT. Differentiator: database-driven persistence allows multiple bot instances sharing one DB, with simple env-based setup.
npm install baileys-databaseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes WhatsApp bot with MySQL/MongoDB auth state persistence via .env configuration.
Run: npm install mysql2 or npm install mongodb
Always set a unique session name per bot instance.
Add await: const { state } = await useDatabaseAuthState();Add require('dotenv').config() at the top of your entry file.npm install mysql2
npm install mongodb
Use: const { useDatabaseAuthState } = require('baileys-database')Ensure .env is loaded and DB credentials are correct. Add await before useDatabaseAuthState().