Telegram
Mini App Game
A Hamster Kombat-style idle game built as a Telegram Mini App. Players earn passive income, buy upgrades, compete on a leaderboard, and make purchases with Telegram Stars — all without a dedicated backend server.
What telegram mini apps are?Tech Stack
Architecture
Serverless architecture with no dedicated API. Next.js Server Actions handle all game logic, communicating directly with MongoDB and the Telegram Bot API.
Key Features
Idle Passive Income
Core clicker-style loop where players accumulate in-game currency passively over time. Offline earnings calculated on session resume based on elapsed time and owned upgrades.
Upgrades & Shop
Players can spend earned currency on upgrades that boost passive income rate. Each upgrade tier unlocks new multipliers, persisted in MongoDB per user.
Telegram Stars Payments
Integrated native Telegram Stars invoices for in-app purchases. Users can buy premium upgrades or boosters directly within the Mini App using Telegram's built-in payment flow.
Leaderboard, Referrals & Daily Rewards
Global leaderboard ranked by total earnings. Referral system tied to Telegram's invite links grants bonus currency. Daily reward streak incentivizes return sessions.
Challenges & Solutions
Real problems encountered during development and how they were resolved.
No dedicated backend
Used Next.js Server Actions as a lightweight serverless API layer; each game action (collect earnings, buy upgrade, claim reward) maps to a single server action with MongoDB read/write
Calculating offline earnings without a background worker
Stored last-seen timestamp in MongoDB per user; on session start, server action computes elapsed time and applies the income rate formula before returning updated state to the client
Validating Telegram Stars invoice callbacks securely
Verified payment webhooks using Telegram Bot API's pre_checkout_query flow inside a Server Action; purchase credited only after successful_payment event confirmed by Telegram
Why It Was Abandoned
The only purpose of this project was to learn how telegram mini apps work.