Public
Gamified Arcade Telegram Mini App with Hono, React, SQLite
gamehonomini-appreacttelegram
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ€“ all from the browser, and deployed in milliseconds.

๐ŸŽฎ Gamified Arcade โ€” Telegram Mini App

A complete, full-stack Telegram Mini App (TMA) for a gamified arcade platform, built as a single Val Town project.

  • Backend: Hono + std/sqlite (persistent), HMAC-secured Telegram initData auth, provably-fair server-side game logic.
  • Frontend: React 18 + Tailwind (Twind) + Framer Motion, styled with native Telegram theme variables, Haptic Feedback, skeleton loading.
  • Payments: Telegram Stars (XTR) invoice generation + TON option + webhook credit handler.

๐Ÿ”— Live app

Try the app

๐Ÿงฉ Files

  • 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).

โš™๏ธ Configuration (env vars, with fallback defaults embedded)

VarDefaultPurpose
BOT_TOKENembeddedValidates Telegram initData HMAC SHA-256
ADMIN_TELEGRAM_IDS6819127801Comma-separated admin IDs (admin dashboard access)
PROVIDER_TOKEN_STARSXTRTelegram Stars provider token
BOT_USERNAMEYourArcadeBotUsed to build t.me/bot?start=REF_ID referral links

๐Ÿ› ๏ธ Setup

  1. Set your real BOT_TOKEN and ADMIN_TELEGRAM_IDS in the val's environment variables.
  2. Point your Telegram bot's Mini App URL at the live endpoint (see above).
  3. Set your bot's webhook to โ€ฆ/api/webhook/telegram to receive Stars pre_checkout_query and payment confirmations.

๐ŸŽฒ Games

  • Space Booster โ€” crash simulator. Server picks a crash point via HMAC; eject before it crashes to win bet ร— multiplier.
  • Color Wheel โ€” 3 sectors: Alpha (x2), Beta (x2), Gamma (x14). Server decides the winning sector.
  • Match Predictor โ€” stake points on fixture outcomes; correct predictions pay out at the odds.

๐Ÿง‘โ€๐Ÿ’ผ Admin Dashboard

Visible only to users whose Telegram ID is in ADMIN_TELEGRAM_IDS:

  • Dynamic Text Studio โ€” edit any UI label (game names, currency symbol, buttons) live in app_config.
  • Promo Code Generator โ€” create codes with reward amount + max activations.
  • User search & balance management.

Demo promo code seeded: WELCOME (+50 โญ).

๐Ÿ—„๏ธ Database (std/sqlite)

Tables: users, promo_codes, user_promos, app_config, transactions, games_state. All created idempotently with CREATE TABLE IF NOT EXISTS on startup.