Tutorial
Lesson 0 — What you are building
Two small Node programs: one holds your Discord bot, the other runs your first app logic over a WebSocket.
You will run two processes:
- Bot process — connects to Discord and hosts a small WebSocket server (
createBotBridge). - App process — connects to that server (
connectBotBridge) and reacts to Discord events without owning the bot token’s gateway session.
Prerequisites
You should be comfortable with Node.js, npm, and environment variables. If you are brand new to JavaScript, learn the basics first (for example javascript.info), then come back.
The moving parts
- The bot process is the only place that should use
DISCORD_TOKENfor the gateway. - The app process uses a shared
SHARDWIRE_SECRETto authenticate to your bridge, not your Discord token.
What you will have after the next lessons
- Both processes running locally.
- A message in Discord that makes your app process log or reply.
- A short checklist for the usual “it connected but nothing happens” issues.