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.
Full API surfaces generated directly from TypeScript source code. Browse bridge APIs, transports, and strictly-typed events.
import { createBotBridge } from 'shardwire';// 1. Bot process: gateway + bridge serverconst bridge = createBotBridge({token: process.env.DISCORD_TOKEN!,intents: ['Guilds', 'GuildMessages', 'GuildMembers', 'MessageContent'],server: {port: 3001,secrets: [process.env.SHARDWIRE_SECRET!],},});await bridge.ready();
import { connectBotBridge } from 'shardwire/client';// 2. App process: The Connection + typed subscriptionsconst 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();
The bot bridge (body) holds Discord. Your app (brain) connects over The Connection—restart the app without dropping the gateway.
Keeping it alive covers hosts like Railway and Render; Troubleshooting helps when errors include doc links.
Optional strict startup catches intent and manifest mismatches early—see Reference for defineShardwireApp and diagnostics.