A complete, full-stack Telegram Mini App (TMA) for a gamified arcade platform, built as a single Val Town project.
std/sqlite (persistent), HMAC-secured Telegram initData auth, provably-fair server-side game logic.XTR) invoice generation + TON option + webhook credit handler.api.tsx — Hono backend: auth, config, admin, promo, referrals, payments, webhook, and all three games.frontend/root.tsx — HTML shell (stamps the immutable client entry).frontend/index.tsx — the single-file React client (all screens).| Var | Default | Purpose |
|---|---|---|
BOT_TOKEN | embedded | Validates Telegram initData HMAC SHA-256 |
ADMIN_TELEGRAM_IDS | 6819127801 | Comma-separated admin IDs (admin dashboard access) |
PROVIDER_TOKEN_STARS | XTR | Telegram Stars provider token |
BOT_USERNAME | YourArcadeBot | Used to build t.me/bot?start=REF_ID referral links |
BOT_TOKEN and ADMIN_TELEGRAM_IDS in the val's environment variables.…/api/webhook/telegram to receive Stars pre_checkout_query and payment confirmations.bet × multiplier.Visible only to users whose Telegram ID is in ADMIN_TELEGRAM_IDS:
app_config.Demo promo code seeded: WELCOME (+50 ⭐).
Tables: users, promo_codes, user_promos, app_config, transactions, games_state. All created idempotently with CREATE TABLE IF NOT EXISTS on startup.