This repository contains a small Telegram Mini App (web app) — frontend and a simple backend — for demo / testing only.
It uses a virtual currency (TestCredits). Do not use for real money gambling.
frontend/— static Web App (HTML, CSS, JS) that works inside Telegram's Web App container.backend/— simple Node/Express server storing per-user balances indb.json.
Open frontend/index.html in a browser for local testing.
For Telegram integration, you must serve it over HTTPS and register URL with BotFather.
cd backend
npm install
node server.jsBy default the backend listens on port 4000.
- Use Vercel or Netlify: create a new project, point the repo or upload the
frontendfolder, and deploy. - Or serve the
frontendfolder from any static host (must be HTTPS).
- Use Render (free tier) or Railway:
- Push
backendto GitHub. - Create a new Web Service on Render, connect the repo, set
npm startas the start command.
- Push
- Create a bot with @BotFather:
/newbotto create a bot; BotFather will return a bot token.
- Register your Web App / Mini App:
- Use BotFather commands to create a main Mini App or set the domain. You can use
/newappand follow instructions, or/setdomainto link the domain for the web widget (see Telegram docs). - Official docs: https://core.telegram.org/bots/webapps and https://core.telegram.org/widgets/login
- Use BotFather commands to create a main Mini App or set the domain. You can use
- Once the Mini App is registered and the domain/URL set, users can open it from your bot's profile or a menu button.
- The Web App receives
initDatafrom Telegram (user info). For server-backed accounts, use thatinitDatato identify users on your backend.
- This is a demo. No real-money payments integrated.
- Be careful when allowing "cheater" options; only for development/testing.