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

@discordkit/client

v4.3.0

Published

A REST API Client for Discord

Readme

Discordkit Discordkit

npm version CI status

A TypeScript SDK for Discord, with support for the REST API and the native Social SDK.


What is Discordkit?

Discordkit is a monorepo of small, focused, tree-shakeable packages. Use them to build Discord apps and integrations in TypeScript. It covers three surfaces:

  • The REST/HTTP API. A fully-typed Fetcher and a valibot schema for every Discord endpoint. Composition helpers add runtime validation, react-query, and tRPC. The OAuth2 utilities assume no framework.
  • The Gateway. A WebSocket client for real-time events, where each dispatch event is its own import. It runs on Cloudflare Workers, Durable Objects, and Node.
  • The native Social SDK. A functional bridge to Discord's Social SDK for desktop runtimes: rich presence, OAuth, relationships, lobbies, messaging, and voice. Adapters run it in an Electron main process or a Tauri sidecar, then expose it to the UI over a typed bridge.

Every package ships ESM, generated .d.ts types, and sideEffects: false. You pay only for what you import.

[!NOTE] Discordkit recently published its first stable releases. The REST surface is complete. The Gateway, the native Social SDK packages, and the examples below are still changing. Expect rough edges, and read each package's own README for current usage.

What it ships

Usage documentation lives in each package's README. This table is the map.

REST / HTTP API

| Package | What it does | | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | @discordkit/client | A Fetcher + valibot schema for every Discord REST endpoint. The main entry point for the HTTP API. | | @discordkit/core | The runtime that powers client: session/token management, the request layer, validation primitives, and the composition helpers toValidated, toQuery, and toProcedure (tRPC). | | @discordkit/oauth | Framework-agnostic Discord OAuth2 utilities (PKCE authorize, token exchange/refresh) with no framework or storage assumptions. |

Realtime / Gateway

| Package | What it does | | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | @discordkit/gateway | A tree-shakeable Gateway (WebSocket) client for Cloudflare Workers, Durable Objects, and Node. Every dispatch event is its own import, with typed intents. |

Native / Social SDK

| Package | What it does | | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | @discordkit/native | Functional TypeScript bridge to the Discord Social SDK for Electron, Tauri, and headless Node — rich presence, auth, users, relationships, lobbies, messaging, and voice. | | @discordkit/electron | Electron adapter for native — run the Social SDK in the main process and reach it from the renderer over a typed IPC bridge. | | @discordkit/tauri | Tauri adapter for native — run the Social SDK in a Node sidecar and reach it from the webview over a typed kkrpc bridge. |

The Social SDK shared library can't be redistributed, so you supply it yourself. See @discordkit/native for how to point the packages at it and which SDK versions are supported.

Examples

Runnable apps in examples/, each wiring one or more packages into a real framework.

| Example | Highlights | | --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | with-cloudflare | Gateway Event Inspector — DevTools for the Gateway, on a Worker + Durable Object (gateway). | | with-electron | Rich Presence live editor (Social SDK via native + electron), modelled on Discord's Developer Portal visualizer. | | with-tauri | A live, tunable unified friends list built on your real Discord relationships (Social SDK via native + tauri). | | with-nextjs | Discord OAuth2 login + authenticated API calls in Next.js (App Router). | | with-nextjs-better-auth | The same, but with Better Auth owning the OAuth2 flow. | | with-astro | OAuth2 login + authenticated calls in Astro (SSR). | | with-tanstack-start | OAuth2 login + authenticated calls in TanStack Start. | | with-waku | OAuth2 login + authenticated calls in Waku. |

Repository layout

packages/    published packages (client, core, oauth, native, electron, tauri)
examples/    runnable example apps, one per framework/runtime
docs/        design notes and architecture specs
static/      logo + brand assets

Working locally

Discordkit uses Vite+ as its toolchain. The global vp CLI drives Oxlint, Oxfmt, tsdown, and Vitest. Bumpy handles versioning and release.

vp install           # install dependencies (run after every pull)
vp check --fix       # format + lint + typecheck, with autofixes
vp test              # run the Vitest suites

To run an example, install at the root, then start it from its directory. Each example's README lists its own dev command and the .env values it needs:

vp install
cd examples/with-nextjs
vp dev

The native Social SDK packages are unit-tested against a mock FFI backend, so vp test needs no SDK binary. A separate CI job loads the real SDK to verify the ABI. That job needs the non-redistributable binary, so it is maintainer-only and never gates contributions.

Contributing

  1. Branch off main and make your change.
  2. Run vp check --fix and vp test until green.
  3. Add a bump file describing what changed: yarn bumpy add (or the /bumpy-add-change skill). This drives the version bump and changelog for your PR.
  4. Open a pull request.

📣 Acknowledgements

Endpoint documentation taken from Discord's Official API docs.

🥂 License

Released under the MIT license © Drake Costa.