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

discord-sync

v1.0.1

Published

Declarative Discord server state engine to export, manage, and reconcile server structures programmatically.

Readme

discord-sync

License: MIT NPM Version Node Version

Declarative Discord server state engine to export, manage, and reconcile server structures (roles, categories, channels, permissions, and initial messages) programmatically in Node.js applications.

Treat your Discord server structure as Infrastructure as Code (IaC).


Installation

npm install discord-sync discord.js

Programmatic Usage

1. Export Server Configuration

import { createDiscordClient, getGuild, exportServerData, closeClient } from 'discord-sync';

const client = await createDiscordClient('YOUR_BOT_TOKEN');
const guild = await getGuild(client, '123456789012345678');

// Export complete guild structure to a JSON-serializable object
const backupData = await exportServerData(guild, { includeEmojis: true });

console.log(JSON.stringify(backupData, null, 2));

closeClient(client);

2. Preview Planned Diffs (Dry-Run Mode)

import { createDiscordClient, getGuild, diffServerData, closeClient } from 'discord-sync';

const client = await createDiscordClient('YOUR_BOT_TOKEN');
const guild = await getGuild(client, '123456789012345678');

const backupData = { /* your server.json structure */ };

// Analyze planned changes without modifying Discord
const diff = await diffServerData(guild, backupData);

console.log('Roles to create:', diff.roles.create);
console.log('Roles to update:', diff.roles.update);
console.log('Channels to delete:', diff.channels.delete);

closeClient(client);

3. Reconcile & Synchronize Server State

import { createDiscordClient, getGuild, restoreServerData, closeClient } from 'discord-sync';

const client = await createDiscordClient('YOUR_BOT_TOKEN');
const guild = await getGuild(client, '123456789012345678');

const backupData = { /* your server.json structure */ };

// Synchronize server state declaratively
await restoreServerData(guild, backupData, {
  cleanMessages: false,   // Set to true to purge existing channel messages
  unpinPrevious: true,    // Unpin old pinned messages when posting new pinned ones
  includeEmojis: true,    // Restore custom server emojis
});

closeClient(client);

API Reference

createDiscordClient(token)

Creates and logs in a modern discord.js Client with required gateway intents.

getGuild(client, guildId)

Fetches and populates the cache for a target Discord Guild by snowflake ID.

exportServerData(guild, [options])

Exports roles, categories, channels, topic, permissions, initial messages, AFK settings, widget, and optional emojis.

diffServerData(guild, backupData, [options])

Computes created, updated, and deleted entities without altering Discord.

restoreServerData(guild, backupData, [options])

Edits existing channels in-place, creates missing ones, restores permissions & messages, and purges undeclared channels.

closeClient(client)

Cleanly destroys the client session.


License

MIT © 2026 Gastón Urgorri.