Node.js
Free Node.js Twitch bot hosting.
Twurple, tmi.js, or anything else on npm. Upload a package.json, name your entry file, and your bot sits in chat around the clock.
Libraries
Libraries that run here
Twurple
The most complete Twitch library for Node: chat, the Helix API and EventSub over WebSocket, written in TypeScript. Its refreshing auth provider renews tokens for you and tells you when to save them.
tmi.js
The long-established chat client, and the one most older tutorials use. Chat only, over IRC. Fine for a command bot; reach for Twurple when you need channel events too.
ComfyJS
A thin, friendly layer over chat for bots that are a few commands and a greeting. The least code between you and a working bot, and the least room to grow.
Deploying
Getting it running
- 1
Upload your project
Drag the folder into the file manager or push it over SFTP. Leave node_modules behind: it is installed for you on deploy and would waste your disk quota.
- 2
Dependencies install themselves
Your package.json is read and installed before the bot starts. Pin your library's major version, because Twitch libraries do change their APIs between majors.
- 3
Point us at your entry file
Usually index.js. The client ID, client secret and first refresh token go into environment variables; the tokens your bot renews afterwards go into a JSON file it writes itself.
Memory
What actually fits in 256 MB
Plenty. Twitch chat is a stream of short text lines, and neither Twurple nor tmi.js keeps a cache of your viewers the way a Discord library keeps a cache of your members. A bot in a few active channels usually sits in tens of megabytes.
The leaks worth looking for are the ones you write. A per-user cooldown map that nothing ever clears, an array of every chat message "for later", a loyalty-points object that holds every viewer who ever typed. Expire what is temporary, and keep what is permanent in a file rather than in memory.
If you add a local overlay or dashboard server to the same process, it shares the same 256 MB. That usually fits; bundling a front-end build step into the bot's start command usually does not.
FAQ
Questions
Twurple or tmi.js?
Twurple if you are starting now, or if you need anything beyond chat: follows, subs, raids and redemptions all arrive over EventSub, which Twurple speaks and tmi.js does not. tmi.js if you are following an existing tutorial for a chat-only bot.
How do I stop having to sign in again after a restart?
Save the tokens every time they are renewed. With Twurple, the refreshing auth provider fires a callback on each refresh; write the new token object to a JSON file there, and read it back at start-up. That file persists across restarts and crashes.
Can I write it in TypeScript?
Yes, and Twurple is written in it. Compile to JavaScript before uploading and point us at the compiled entry file. If you would rather skip the compile step, the Bun page is the one to read.
Can I run timers and scheduled messages?
Yes, with ordinary setInterval inside the bot. Remember Twitch's message rate applies to timers too, and a bot that posts on a timer in several channels spends that allowance faster than one that only answers commands.
Do I need to upload node_modules?
No. Upload your source and your package.json and the dependencies install on deploy.
More on Twitch bots
Hosting something else?
Control it from code