PixelWars is a collaborative pixel art battlefield powered by Deno, WebSockets, and Telegram authentication.
Users can join the game, draw pixels on a shared canvas, and watch the artwork evolve in real time.
- Shared Canvas: A global pixel board where all connected users can draw.
- Real-Time Updates: WebSocket-based synchronization between all players.
- Access Control:
- Read-Only for guests.
- Read-Write for authenticated users (via Telegram bot).
- Persistence: Pixel state is stored in
/data/pixels.binand periodically snapshotted. - Auto-Reconnect: Clients reconnect if the WebSocket drops.
- Telegram Integration:
- Bot checks membership in a Telegram group.
- Provides unique
secret_tokenlinks for verified users. - Guests are redirected to a group invite link.
- Docker
- Docker Compose
- A Telegram bot token (
PIXELWARS_API_KEY)
git clone https://github.com/your-username/pixelwars.git
cd pixelwarsCreate a .env file:
PIXELWARS_API_KEY=your-telegram-bot-tokendocker-compose up -dThe service will be available at http://localhost:8080.
You can run directly with Deno if you prefer:
deno run --allow-all main.js.
βββ Dockerfile # Container setup (Deno runtime)
βββ docker-compose.yml # Orchestration + persistence
βββ main.js # Main server & client logic
βββ README.md # This file
-
Open the canvas in your browser:
http://localhost:8080 -
By default, you are in read-only mode. To draw pixels:
-
Start a private chat with the Telegram bot: @pixelwars_xecut_bot.
-
If youβre a member of the group, the bot gives you a unique access link:
http://pixelwars.xecut.me/?secret_token=xxxx-xxxx-xxxx -
Open the link β youβre now in read-write mode.
-
-
Draw pixels with your mouse or touchscreen.
- All pixel modifications require a valid
secret_token. - Tokens are bound to Telegram users.
- Server runs under a non-root user (
deno:deno) withno-new-privileges.