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

daad

v1.0.6

Published

Discord-as-a-database

Downloads

10

Readme

DaaD

Discord-as-a-Database

Features

  • 🗃️ Use Discord channels as database tables
  • 📝 Full CRUD operations (Create, Read, Update, Delete)
  • 🔍 Query data with custom predicates
  • 📊 Schema-based data structure
  • 💾 Built-in caching for better performance
  • 📦 Handles large data with automatic chunking
  • 🔗 Linked-list storage for data exceeding Discord limits

Installation

npm install daad

Quick Start

import { Bot, ChannelTable } from 'daad';

// Initialize the bot
const bot = new Bot('YOUR_BOT_TOKEN', 'YOUR_GUILD_ID');

// Define a table schema
const userSchema = {
    columns: ['id', 'name', 'email', 'createdAt'],
    primaryKey: 'id'
};

// Create a table
const usersTable = new ChannelTable('users', userSchema);

// Link the table to the bot
await bot.linkTable(usersTable);

// Insert data
await usersTable.insert({
    id: 'user123',
    name: 'John Doe',
    email: '[email protected]',
    createdAt: new Date().toISOString()
});

// Find a record
const user = await usersTable.find('user123');
console.log(user.data);

// Query records
const recentUsers = await usersTable.query(user => {
    const createdDate = new Date(user.createdAt);
    const oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
    return createdDate > oneWeekAgo;
});

// Update a record
await usersTable.update({
    id: 'user123',
    name: 'John Smith',
    email: '[email protected]',
    createdAt: user.data.createdAt
});

// Delete a record
await usersTable.delete('user123');

API Reference

Bot Class

new Bot(bot_token, guild_id, category_name = 'DaaD')

Creates a new bot instance.

  • bot_token (string): Your Discord bot token
  • guild_id (string): The Discord server ID where tables will be created
  • category_name (string, optional): The name of the category to store table channels in. Defaults to 'DaaD'.

bot.link_table(table)

bot.linkTable(table)

Links a ChannelTable to the bot and initializes it.

  • table (ChannelTable): The table instance to link

ChannelTable Class

new ChannelTable(table_name, schema)

Creates a new ChannelTable instance.

  • table_name (string): Name of the table (will be used as channel name)
  • schema (object): Table schema with a columns array and a primaryKey string.

table.insert(data)

Inserts a new record into the table.

  • data (object): The data object to insert (must include primary key)
  • Returns: Promise resolving to the created Discord message

table.find(primary_key_value)

Finds a record by its primary key.

  • primary_key_value: The value of the primary key to search for
  • Returns: Promise resolving to {data: object, messages: Map<string, Message>} or null

table.query(predicate)

Queries records using a predicate function.

  • predicate (function): Function that receives a data object and returns boolean
  • Returns: Promise resolving to an array of matching data objects

table.update(new_data)

Updates an existing record.

  • new_data (object): The complete new data object (must include primary key)
  • Returns: Promise resolving to the created Discord message

table.delete(primary_key_value)

Deletes a record from the table.

  • primary_key_value: The primary key value of the record to delete
  • Returns: Promise resolving to boolean (true if successful)

Setup Requirements

  1. Discord Bot: Create a Discord application and bot at https://discord.com/developers/applications
  2. Bot Permissions: Ensure your bot has the following permissions in your server:
    • Manage Channels
    • Send Messages
    • Read Message History
    • Manage Messages
  3. Bot Intents: The bot requires these Gateway Intents:
    • Guilds
    • Guild Messages
    • Message Content

How It Works

DaaD uses Discord channels as database tables:

  • Each table becomes a Discord channel under a "DaaD" or custom category
  • Records are stored as Discord messages with embedded JSON data
  • Large records are automatically chunked across multiple messages
  • Messages are linked together using footer references for data reconstruction
  • The bot manages all Discord API interactions transparently

Limitations

  • Discord API rate limits apply to all operations
  • Message history is limited (older messages may not be accessible)
  • Bulk operations are limited by Discord's bulk delete restrictions (14-day limit)
  • Query performance depends on channel message history size

License

AGPL-3.0-or-later

Author

TotoCodeFR