GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - open-devhub/chorddb: A lightweight, simple Database like MongoDB which uses Discord as storage.

BranchesTags
Open more actions menu

Latest commit

 

History

37 Commits
37 Commits

Folders and files

NameName
Last commit message
Last commit date
assets
assets
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.prettierignore
.prettierignore
 
 
.prettierrc
.prettierrc
 
 
LICENCE
LICENCE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
tsconfig.json
tsconfig.json
 
 
tsup.config.ts
tsup.config.ts
 
 

Repository files navigation

ChordDB

Built with Node.js TypeScript npm

ChordDB is a lightweight, MongoDB-inspired database that uses Discord channels as storage, with end-to-end encryption and optional wrapper-based caching for performance.

It is designed primarily for bots, prototypes, and small-scale systems where simplicity and zero external infrastructure matter.

Features

  • ๐Ÿ“ฆ Discord messages as database records (1 message = 1 document)
  • ๐Ÿ” AES-GCM encryption using Node.js crypto
  • ๐Ÿง  Mongo-like query & update operators ($set, $inc, $unset, $push)
  • โšก Cache-aware fetching (recommended with Discord API wrappers)
  • ๐Ÿงฉ ESM-first with CJS support
  • ๐Ÿงช Works with plain JSON data

Installation

npm

npm install chorddb

Importing

ESM (recommended)

import { Chord } from "chorddb";

CommonJS

const { Chord } = require("chorddb");

Initialization

Create a Chord instance

import { Chord, getKey } from "chorddb";

const chord = new Chord({
	token: "YOUR_BOT_TOKEN",
	key: getKey("YOUR_ENCRYPTION_KEY_OR_PASSWORD"),
	collections: [
		{ name: "users", channelId: "1469947881367797825" },
		{ name: "shop", channelId: "1469947881367797826" },
	],
});

Note

You can optionally provide a Discord API wrapper (discord.js, oceanic, bakit, etc.) to enable cache-based reads and reduce REST usage.

Use with Discord API wrappers

import { Chord } from "chorddb";
import { Client, GatewayIntentBits } from "discord.js";

const client = new Client({
	intents: [
		GatewayIntentBits.Guilds,
		GatewayIntentBits.GuildMessages,
		GatewayIntentBits.MessageContent,
	],
});

const chord = new Chord({
	token: "YOUR_BOT_TOKEN",
	key: getKey("YOUR_ENCRYPTION_KEY_OR_PASSWORD"),
	collections: [...]
});

// Listen for gateway payloads to make sure the cache is up-to-date
client.on("raw", (payload) => chord.updateGatewayPayload(payload));

// Enable wrapper mode for caching
// You can either use await it or just let it run
await chord.useWrapper();

await client.login("YOUR_BOT_TOKEN");

Create / Access a Collection

const users = chord.collect("users");
const guilds = chord.collect("guilds");

Basic Usage

Insert a document

await users.insertOne({
	username: "someone",
	coins: 100,
});

let moreUsers = await users.insertMany([
	{ username: "someone else", coins: 200 },
	{ username: "another user", coins: 300 },
]);

Find documents

await users.find({
	username: "someone",
});

await users.findById("123"); // ID is the message ID

or using a predicate:

const richUsers = await users.find((doc) => doc.coins > 500);

Update documents

await users.updateOne(
	{ username: "someone" },
	{
		$inc: { coins: 50 },
		$set: { premium: true },
	},
);

await users.updateMany((doc) => doc["coins"] < 300, {
	$dec: { coins: 20 },
});

Delete Documents

await users.deleteOne({ username: "someone else" });

await users.deleteMany((doc) => doc["coins"] < 150);

Fetch all documents

const allUsers = await users.findAll();

Query & Update Operators

Supported filters

  • Object matching
  • Predicate functions

Supported update operators

  • $set
  • $inc
  • $dec
  • $unset
  • $push

(Operator behavior is intentionally Mongo-like but simplified.)

Performance Notes

  • Cache is optional but strongly recommended
  • Without a wrapper cache, ChordDB falls back to paginated REST fetching
  • Fetching is lazy and incremental to avoid rate limits

Intended Use Cases

  • โœ… Prototype bots
  • โœ… Startup MVPs
  • โœ… Small persistent data needs
  • โš ๏ธ Not intended for high-write or large-scale production databases

Roadmap

  • Image / binary uploads
  • Indexing helpers
  • Better schema validation
  • Query optimization

Contributing

Contributions are welcome! Please open an issue or pull request if you have any suggestions or find any bugs.

Thanks to everyone who helps make ChordDB better!

About

A lightweight, simple Database like MongoDB which uses Discord as storage.

Topics

chordchorddbdatabasedbdevhubdiscorddiscord-databasediscord-jsdiscordjsdjsdvhjavascriptmongodbnodejsnon-relational-databasesqltypescript

Resources

Readme
MIT license
Activity
Custom properties

Stars

6 stars

Watchers

1 watching

Forks

1 fork
Report repository

Contributors

Languages

You are visitor 01402520 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.