SHARDWIRE
  • Docs
  • Reference
  • npm
Discord bots without the downtime scare

Keep the Discord gateway stable.
Move the rest independently.

Shardwire keeps your Discord connection running while you restart or deploy your code. Hot-reload app logic, typed events and actions, and browse the full API in Reference when you need the details.

01. Install

$npm install shardwire
First slash commandOr jump to Getting Started

02. Reference

Full API surfaces generated directly from TypeScript source code. Browse bridge APIs, transports, and strictly-typed events.

Browse API Reference
Bot + app (The Connection)
bot-process.ts
import { createBotBridge } from 'shardwire';
// 1. Bot process: gateway + bridge server
const bridge = createBotBridge({
token: process.env.DISCORD_TOKEN!,
intents: ['Guilds', 'GuildMessages', 'GuildMembers', 'MessageContent'],
server: {
port: 3001,
secrets: [process.env.SHARDWIRE_SECRET!],
},
});
await bridge.ready();
app-process.ts
import { connectBotBridge } from 'shardwire/client';
// 2. App process: The Connection + typed subscriptions
const app = connectBotBridge({
url: 'ws://127.0.0.1:3001/shardwire',
secret: process.env.SHARDWIRE_SECRET!,
appName: 'dashboard',
});
app.on('messageCreate', ({ message }) => {
console.log('message', message.channelId, message.content);
});
await app.ready();

Product focus

Mental model

Body + brain

The bot bridge (body) holds Discord. Your app (brain) connects over The Connection—restart the app without dropping the gateway.

Running your bot

Ship it

Keeping it alive covers hosts like Railway and Render; Troubleshooting helps when errors include doc links.

When you grow

Strict checks

Optional strict startup catches intent and manifest mismatches early—see Reference for defineShardwireApp and diagnostics.