Runtime Separation for Discord
Keep the gateway stable.
Move the rest independently.
Shardwire splits Discord event runtime from the app code that consumes it. A TypeScript-first bridge with scoped secrets, strict startup contracts, and generated reference docs.
02. Reference
Full API surfaces generated directly from TypeScript source code. Browse the bridge architecture, transports, and strictly-typed events.
Split Architecture Example
bot-process.ts
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();
app-process.ts
import { connectBotBridge } from 'shardwire';// 2. App process: WebSocket client + 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();
Product focus
Architecture
Bridge-first Design
The docs start with the runtime split itself: what moves to the bot process, what stays in your app process, and where capabilities are negotiated.
Operations
Built for Production
Deployment, diagnostics, scoped-secret safety, and troubleshooting live alongside API docs instead of as an afterthought.
Guarantees
Strict Startup
Strict startup turns mismatches into startup failures instead of silent drift. Mismatched intents break instantly, not at runtime.