Installation
Requirements
Section titled “Requirements”| What | Version |
|---|---|
| Node.js | 22.12 or later (24 LTS recommended; 24.11 for embedded mode) |
| discord.js | 14.12 or later, and 15 |
| Intents | Guilds only. No privileged intents. |
| Collector | Any server with Docker, or Railway or Render. PostgreSQL 16 or 17 |
The SDK ships ESM and CommonJS builds with type definitions, so it works with import and require, TypeScript and
plain JavaScript.
Install
Section titled “Install”pnpm add @shardlens/discordjsnpm install @shardlens/discordjsyarn add @shardlens/discordjsbun add @shardlens/discordjsdiscord.js is a peer dependency: the SDK uses the copy your bot already has. Releases before 14.12 use an older REST
client whose responses Shardlens can’t read, so it needs 14.12 or later.
Packages
Section titled “Packages”| Package | What it is |
|---|---|
@shardlens/discordjs |
The discord.js adapter. This is the one you install. |
@shardlens/core |
Zero-dependency core used by the adapter: queue, salts, hashing, batching, retries, redaction. |
@shardlens/schema |
The wire format (zod), JSON Schema, and the metric and data-collected registers. |
shardlens |
The CLI: init, keys, privacy, doctor. |
Check your setup
Section titled “Check your setup”npx shardlens doctor --url https://stats.example.com --key slk_ingest_…doctor checks your Node and discord.js versions, that the collector is reachable over HTTPS and that it accepts your
key. Run it from your bot’s folder so it finds the right discord.js.