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

cordix

v0.0.4

Published

Modern and flexible Discord bot library for TypeScript and JavaScript.

Readme

Corda Discord Library

NPM Version Discord License

Cordix - Modern Discord Bot Library [Alpha]

Cordix is a modern, flexible, and scalable Discord bot library for TypeScript and JavaScript. It features a powerful event system (with aliases like onReady, messageCreate), full control over the Discord Gateway, REST API, sharding, and graceful shutdown.


🚀 Features

  • 100% TypeScript (works in JS & TS)
  • Event aliases like onReady, messageCreate — or use raw Discord events such as READY, MESSAGE_CREATE.
  • Fully typed REST API client
  • Intents & Presence support
  • Automatic or manual sharding
  • Built-in logger & graceful shutdown (handleShutdown())

📦 Installation

npm install cordix

⚡ Quick Start

import { Client, Constants } from "cordix";

const client = new Client({
  token: "YOUR_BOT_TOKEN",
  intents: Constants.DefaultIntents,
  presence: {
    status: "online",
    activities: [{ name: "My Awesome Bot", type: 0 }],
  },
  debug: true,
});

client
  .on("onReady", () => {
    console.log(`${client.user.username} is ready!`);
  })
  .on("messageCreate", async (message) => {
    if (message.author.bot) return;
    if (message.content === "!ping") {
      client.sendMessage(message.channel_id, "🏓 Pong!");
    }
  });

client.login();
client.handleShutdown(); // Handles graceful exit (SIGINT/SIGTERM)

🧩 Sharding Example

To enable sharding, just set totalShards:

const client = new Client({
  token: "YOUR_BOT_TOKEN",
  intents: Constants.DefaultIntents,
  totalShards: "auto", // or a number
  debug: true,
});

client.on("shardReady", (shardId) => {
  console.log(`Shard ${shardId} is ready!`);
});
client.login();

📚 API Reference (Main Client)

new Client(options)

  • token: string — Your bot token (required)
  • intents: number — Intents bitmask (see Constants.Intents)
  • presence: object — Presence data (status, activities, etc.)
  • totalShards: number | "auto" — Shard count (optional)
  • debug: boolean — Enable debug logs (optional)

Properties

| Property | Type | Description | | -------------- | ------------ | ----------------------------- | | user | object | Bot user object (after login) | | shardManager | ShardManager | Sharding controller | | rest | RestManager | REST API client | | eventManager | EventManager | Event system | | intents | number | Intents bitmask | | totalShards | number | Number of shards | | debug | boolean | Debug mode |

Methods

| Method | Description | | ------------------------------ | ----------------------------------------------------- | | login() | Connects to Discord Gateway | | handleShutdown() | Handles graceful shutdown (SIGINT/SIGTERM) | | sendMessage(channelId, data) | Send message to a channel (string or full API object) | | getUser(userId) | Fetch user info via REST | | rest.get(path) | Raw REST GET request | | rest.post(path, body) | Raw REST POST request |


🔔 Event System

Corda supports both raw Discord Gateway events and friendly aliases for better readability.

Common Aliases

| Alias | Gateway Event | Description | | ----------------- | ------------------ | ------------------ | | onReady | READY | Bot is ready | | messageCreate | MESSAGE_CREATE | New message | | shardReady | SHARD_READY | Shard is ready | | shardDisconnect | SHARD_DISCONNECT | Shard disconnected | | error | ERROR | Error on shard |

You can also listen to raw events by their Discord name.


📨 Sending Messages

You can send a message as a string or as a full Discord API object:

// Simple text
client.sendMessage(channelId, "Hello!");

// Full API object (embeds, files, etc)
client.sendMessage(channelId, {
  content: "Hello!",
  embeds: [ ... ],
  tts: false,
});

🌐 REST API Usage

// Get bot user info
const user = await client.rest.get("/users/@me");

// Send message using REST
await client.rest.post(`/channels/${channelId}/messages`, {
  content: "Hello via REST!",
});

🧰 Utility Methods

| Method | Description | | ---------------------- | ---------------------------------------------- | | client.login() | Connect to the Discord Gateway | | client.sendMessage() | Send a message directly to a channel | | client.rest.get() | Perform a REST GET request | | client.rest.post() | Perform a REST POST request | | client.OnShutDown() | Graceful shutdown on SIGINT, SIGTERM, etc. |


✅ Why Cordix?

  • Clean, minimal, and intuitive
  • Type-safe, but compatible with plain JS
  • Alias event system for developer-friendly code
  • Works in bots of any scale — with or without sharding
  • Focused on performance and flexibility

📜 License

MIT

Contributions welcome! Open issues or PRs to help improve the library.