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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wwebjs-supabase

v1.1.0

Published

A Supabase plugin for whatsapp-web.js to store session data in Supabase Storage

Readme

wwebjs-supabase

npm version npm downloads GitHub license GitHub issues

A Supabase plugin for whatsapp-web.js!

Use SupabaseStore to save your WhatsApp MultiDevice session on a Supabase Database.

Quick Links

Installation

The module is available on npm:

npm i wwebjs-supabase

Getting Started

This plugin allows you to store your WhatsApp Web.js session data in Supabase, providing a reliable and scalable database solution for your WhatsApp bot sessions.

Prerequisites

  • Node.js (v14 or higher)
  • A Supabase project with database access
  • whatsapp-web.js installed

Example Usage

const { Client, RemoteAuth } = require('whatsapp-web.js');
const { SupabaseStore } = require('wwebjs-supabase');
const { createClient } = require('@supabase/supabase-js');

// Initialize Supabase client
const supabase = createClient(
    process.env.SUPABASE_URL,
    process.env.SUPABASE_ANON_KEY
);

// Create store instance
const store = new SupabaseStore({ 
    supabase: supabase,
    tableName: 'whatsapp_sessions' // optional, defaults to 'sessions'
});

// Initialize WhatsApp client with Supabase store
const client = new Client({
    authStrategy: new RemoteAuth({
        store: store,
        backupSyncIntervalMs: 300000
    })
});

client.initialize();

Configuration

Environment Variables

Create a .env file in your project root:

SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key

Database Setup

Create a table in your Supabase database:

CREATE TABLE whatsapp_sessions (
    id SERIAL PRIMARY KEY,
    session_id VARCHAR(255) UNIQUE NOT NULL,
    data JSONB NOT NULL,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- Create an index for better performance
CREATE INDEX idx_whatsapp_sessions_session_id ON whatsapp_sessions(session_id);

API Reference

SupabaseStore

Constructor Options

  • supabase (required): Supabase client instance
  • tableName (optional): Name of the table to store sessions (default: 'sessions')

Methods

delete(options)

Force delete a specific remote session from the database:

await store.delete({ session: 'yourSessionName' });
save(sessionId, data)

Save session data to Supabase:

await store.save('sessionId', sessionData);
extract(sessionId)

Extract session data from Supabase:

const sessionData = await store.extract('sessionId');

Error Handling

const client = new Client({
    authStrategy: new RemoteAuth({
        store: store,
        backupSyncIntervalMs: 300000
    })
});

client.on('auth_failure', (msg) => {
    console.error('Authentication failed:', msg);
});

client.on('disconnected', (reason) => {
    console.log('Client was logged out:', reason);
});

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue if your problem isn't already reported
  3. Provide detailed information about your setup and the issue

Changelog

Version 1.0.0

  • Initial release
  • Basic Supabase integration for whatsapp-web.js
  • Session management functionality
  • CRUD operations for session data

Related Projects

Acknowledgments

  • Inspired by wwebjs-mongo
  • Built for the whatsapp-web.js community
  • Thanks to the Supabase team for their excellent database platform