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

discordforge-sdk

v1.1.2

Published

The official Node.js SDK for the DiscordForge platform

Readme


Installation

npm install discordforge-sdk

Requirements: Node.js 18 or higher.

Quick Start

const { ForgeClient } = require("discordforge-sdk");

const client = new ForgeClient("YOUR_API_KEY", "YOUR_BOT_ID");

// Post your bot stats
await client.postStats({
  serverCount: 1500,
  shardCount: 2,
});

// Check if a user voted
const vote = await client.checkVote("USER_DISCORD_ID");
if (vote.hasVoted) {
  console.log("Thanks for voting!");
}

ESM / TypeScript

import { ForgeClient } from "discordforge-sdk";

const client = new ForgeClient("YOUR_API_KEY", "YOUR_BOT_ID");
const bot = await client.getBot();
console.log(`${bot.name} – ${bot.voteCount} votes`);

API Reference

new ForgeClient(apiKey, botId?, options?)

| Parameter | Type | Description | |-----------|------|-------------| | apiKey | string | Your DiscordForge API key | | botId | string? | Your bot's Discord snowflake ID (required for checkVote and getBot) | | options.timeout | number | Request timeout in ms (default: 10000) | | options.retries | number | Auto-retry count on failure (default: 3) |

Methods

| Method | Returns | Description | Rate Limit | |--------|---------|-------------|------------| | postStats(stats) | Promise<void> | Update your bot's server/shard/user stats | 1 req / 5 min | | checkVote(userId) | Promise<VoteMetadata> | Check if a user voted in the last 8h | 60 req / min | | getBot() | Promise<BotInfo> | Fetch your bot's public profile | – | | syncCommands(commands) | Promise<{ success, synced }> | Sync up to 200 slash commands | – |

new AutoPoster(forgeClient, discordClient, options?)

Automatically posts stats to DiscordForge on a fixed interval. Works with discord.js, Eris, or any client that exposes guilds.cache.size.

const { ForgeClient, AutoPoster } = require("discordforge-sdk");

const forge = new ForgeClient("YOUR_API_KEY");
const poster = new AutoPoster(forge, discordClient);

poster.on("post", (stats) => console.log(`Posted: ${stats.serverCount} servers`));
poster.on("error", (err) => console.error(err));

| Option | Type | Default | Description | |--------|------|---------|-------------| | interval | number | 300000 | Posting interval in ms (min: 5 minutes) | | startImmediately | boolean | true | Post stats as soon as the client is ready | | onPost | function | – | Callback fired after each successful post | | onError | function | – | Callback fired on posting failure |

| Method | Description | |--------|-------------| | start() | Start the loop (called automatically on client ready) | | stop() | Pause the loop | | destroy() | Stop and remove all listeners | | isRunning | Whether the poster is active |

Types

All interfaces are exported for use in your own code:

import type { BotStats, BotInfo, VoteMetadata, SyncCommand } from "discordforge-sdk";

Usage with discord.js

const { Client, GatewayIntentBits } = require("discord.js");
const { ForgeClient } = require("discordforge-sdk");

const bot = new Client({ intents: [GatewayIntentBits.Guilds] });
const forge = new ForgeClient("YOUR_API_KEY", "YOUR_BOT_ID");

bot.once("ready", async () => {
  // Post stats on startup
  await forge.postStats({ serverCount: bot.guilds.cache.size });

  // Update stats every 30 minutes
  setInterval(async () => {
    await forge.postStats({ serverCount: bot.guilds.cache.size });
  }, 30 * 60 * 1000);

  console.log(`${bot.user.tag} is online – stats synced to DiscordForge`);
});

bot.login("YOUR_BOT_TOKEN");

Error Handling

The SDK throws ForgeAPIError on non-2xx responses. Rate limits (429) are automatically retried.

const { ForgeClient, ForgeAPIError } = require("discordforge-sdk");

try {
  await client.postStats({ serverCount: 100 });
} catch (err) {
  if (err instanceof ForgeAPIError) {
    console.error(`API error ${err.status}:`, err.body);
    if (err.retryAfter) {
      console.log(`Retry after ${err.retryAfter}s`);
    }
  }
}

Examples

See the examples/ directory:

Links

License

MIT © DiscordForge

Forge Bot Widget

Forge Widget