Companion repo for “Goodbye World, Hello Battlesnake” (Commit Your Code Conference)
This project shows how to build a tiny tinyhttp Battlesnake server, then add strategy control over WebSockets using Twilio Conversation Relay and a local LLM (Ollama).
- Node.js 18+
- pnpm (preferred):
npm i -g pnpm - ngrok (to expose
localhost:3000) - Twilio (Programmable Voice + Conversation Relay)
– a Twilio account and a voice-enabled phone number - Ollama (for local LLM): https://ollama.com/
– run
ollama serveand pull the required model:ollama pull qwen2.5:1.5b
Create a .env (based on .env.example):
NGROK_URL=https://your-subdomain.ngrok.app
NGROK_URLis used to form public callback / WS URLs for Twilio & Battlesnake.
pnpm installEach file in demo/ is standalone and builds on the previous one:
# Demo 1: Hello Battlesnake (basic server)
npm run 1
# Demo 2: LLM Move (creative strategy interpretation with qwen2.5:1.5b)
npm run 2
# Demo 3: Voice Control (Twilio voice updates strategy)
npm run 3
# Demo 4: Full Snake (voice + colors + streaming commentary)
npm run 4
# or
npm start
# Development mode (auto-reload)
npm run devServers listen on http://localhost:3000.
ngrok http 3000Copy the https URL into .env as NGROK_URL.
.
├─ demo/
│ ├─ 1-hello.js - Basic Battlesnake server
│ ├─ 2-llmmove.js - LLM-powered movement
│ ├─ 3-voicesnake.js - Voice control via Twilio
│ └─ 4-fullsnake.js - Full implementation with streaming commentary
├─ package.json
├─ .env
└─ README.md
- Voice-controlled strategy: Say "go towards where the sun sets" and the LLM interprets it
- Voice-controlled colors: Say "Color blue" to change your snake's color
- Streaming commentary: AI-generated sports commentary streamed in real-time after each game
- Educational logging: Clean emoji-based logs showing what's happening
- qwen2.5:1.5b: Handles all tasks - movement strategy, color conversion, and sports commentary generation