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

@harmonixjs/quick-db

v1.0.0

Published

Quick.db plugin for Harmonix Discord framework - Simple & Flexible

Readme

@harmonixjs/quick-db

Simple and flexible Quick.db plugin for Harmonix Discord framework.

Installation

npm install @harmonixjs/quick-db quick.db better-sqlite3

Quick Start

import { Harmonix } from "@harmonixjs/core";
import { DatabasePlugin } from '@harmonixjs/quick-db';

const bot = new Bot({
  bot: {
    id: "YOUR_BOT_CLIENT_ID",
    token: "YOUR_BOT_TOKEN"
  },
  publicApp: true,
  folders: {
    commands: "./src/commands",
    events: "./src/events",
    components: "./src/components"
  },
  intents: [3249151],
  plugins: [
    new DatabasePlugin({
        filePath: './data/database.sqlite'
    })
  ]
});

// OR
bot.use(new DatabasePlugin({...}))

bot.start();

Usage

Define your own types

// types/User.ts
export interface User {
  discordId: string;
  username: string;
  coins: number;
  level: number;
}

// types/Guild.ts
export interface Guild {
  guildId: string;
  prefix: string;
  language: string;
  premium: boolean;
}

Create typed tables

import { User } from './types';

// Create tables with your types
const users = bot.database.table('users');

// Everything is typed!
await users.set('user_123', {
  discordId: '123',
  username: 'John',
  coins: 100,
  level: 5,
});

const user = await users.get('user_123');
// user is typed as User | null

Basic Operations

// Set
await users.set('user_123', { ... });

// Get
const user = await users.get('user_123');

// Get typed (returns null instead of undefined)
const user = await users.getTyped('user_123');

// Update partial
await users.update('user_123', { coins: 200 });

// Delete
await users.delete('user_123');

// Check existence
const exists = await users.exists('user_123');

// Count
const count = await users.count();

// Get all
const allUsers = await users.getAllTyped();

// Clear table
await users.clear();

Advanced Queries

// Find one
const richUser = await users.findOne(user => user.coins > 1000);

// Find many
const premiumGuilds = await guilds.findMany(guild => guild.premium === true);

// Filter and sort
const topUsers = (await users.getAllTyped())
  .sort((a, b) => b.value.coins - a.value.coins)
  .slice(0, 10);

API Reference

DatabasePlugin

Constructor

new DatabasePlugin(config?: DatabasePluginConfig)

Config:

  • filePath?: string - Database file path (default: ./data/database.sqlite)

Methods

table<T>(name: string): Database<T>
Create or get a typed table.

getTables(): string[]
List all created tables.

close(): Promise<void>
Close all connections.

Database<T>

Properties

  • table: string - Table name

Methods

get(key: string): Promise<T>
Get value from Quick.db.

set(key: string, value: T): Promise<T>
Set value.

delete(key: string): Promise<number>
Delete key.

update(key: string, updates: Partial<T>): Promise<T | null>
Update partial value.

exists(key: string): Promise<boolean>
Check if key exists.

all(): Promise<Array<{ id: string; value: T }>>
Get all entries.

findOne(predicate): Promise<T | null>
Find one entry matching condition.

findMany(predicate): Promise<Array<T>>
Find all entries matching condition.

count(): Promise<number>
Count entries.

clear(): Promise<void>
Clear entire table.

Philosophy

@harmonixjs/quick-db is intentionally minimal. It provides:

  • ✅ Type-safe database access
  • ✅ Simple API wrapping Quick.db
  • ✅ Full flexibility

It does NOT provide:

  • ❌ Pre-defined schemas (User, Guild, etc.)
  • ❌ Complex ORM features
  • ❌ Migrations or validators

You define your own types and logic. The plugin just makes Quick.db easier and type-safe.

License

MIT © HarmonixJS