No description
| proxy | ||
| server | ||
| web | ||
| .env | ||
| .gitignore | ||
| docker-compose.override.yml.dist | ||
| docker-compose.yml | ||
| README.md | ||
Tetris Lite (Browser)
Lightweight browser Tetris with ranking and online snapshots. Runs in a small container (e.g., Raspberry Pi) and supports async multiplayer via Redis.
Overview
- Local gameplay in the browser (desktop and mobile).
- Persistent arcade-style ranking.
- Online player snapshots (right column).
- Mobile mode: ranking before/after, gameplay + controls during.
Stack
- Frontend: plain HTML/CSS/JS.
- Backend: Go + Redis.
- Proxy: Nginx (web +
/api).
Run with Docker
docker compose up -d --build
Open:
http://localhost:${WEB_PORT}(seeWEB_PORTin.env).
Frontend without rebuilds
Create a local override:
cp docker-compose.override.yml.dist docker-compose.override.yml
docker compose up -d
Edit files in web/ and refresh the browser.
Endpoints
POST /session-> create a session for a nick.POST /snapshot-> send board + score.DELETE /snapshot-> remove current snapshot.GET /online-> list online players.GET /leaderboard-> paginated ranking (limit,offset).GET /rank-> rank for current session.
Configuration
Environment variables in .env:
WEB_PORT: proxy port (e.g., 9000).
Other envs in compose:
REDIS_ADDR: Redis host (defaultredis:6379)SNAPSHOT_TTL_SECONDS: snapshot TTL (default45)SESSION_TTL_SECONDS: session TTL (default86400)
Local dev (no Docker)
- Start Redis locally.
- Server:
cd server
go run .
- Web (any static server):
cd web
python3 -m http.server 5173
Notes
- Ranking tie-break: score (desc) -> session timestamp (asc).
- Snapshots are only considered online if updated recently.