A simple one-page Snake game served locally with a minimal Node.js HTTP server (no external dependencies).
- Node.js (any recent version)
From this project directory, run:
node server.jsYou should see:
Snake game running at http://localhost:3000
Open http://localhost:3000 in your browser to play.
To use a different port:
$env:PORT=8080; node server.js- Arrow keys or WASD — move
- Swipe on the canvas, or the on-screen D-pad — move (touch devices)
- Space — pause / resume, or restart from the Game Over screen
From the title screen, use Start Game, How to Play, the theme picker, and the Sound toggle to get going.
The game is an installable Progressive Web App: open it on a phone and use the browser's "Add to Home Screen" option to launch it full-screen like a native app, including offline play (a Service Worker caches the game's static assets).
If you change index.html, manifest.json, or icons/icon.svg and want returning players to get the update, bump CACHE_NAME in sw.js (e.g. snake-cache-v2) — visitors will see a "New version available" prompt to refresh.
Press Ctrl+C in the terminal where it's running.
index.html— the game (HTML, CSS, and JS in one file)server.js— static file servermanifest.json— PWA app metadata (name, icons, theme color)sw.js— service worker for offline caching and update promptsicons/icon.svg— app icon