DEV Community

Cover image for I Built a DevTools for Telegram Mini Apps So You Don't Have to Debug on Your Phone
Ivan Shevtsov
Ivan Shevtsov

Posted on

I Built a DevTools for Telegram Mini Apps So You Don't Have to Debug on Your Phone

While building a Telegram Mini App recently, I hit the same wall every TMA developer knows:

  1. Code your app locally.
  2. Spin up ngrok (hope it doesn't crash).
  3. Go to @botfather, set the web_app URL to the tunnel.
  4. Grab your phone, launch the app, console.log() and pray.
  5. Repeat for every theme / platform / user combination you need to test.

There's no official Telegram Mini Apps emulator. The workflow is stuck in 2015. Developers in the Russian TMA community have been complaining about it publicly:

"The main difficulty is the inability to run a project as easily as in a browser via localhost β€” and the absence of a developer console." β€” Habr, March 2025

So I built TMA DevKit β€” an open-source local emulator and bridge inspector for Telegram Mini Apps. Think Redux DevTools, but for window.Telegram.WebApp.

How it works (one sentence): you paste your Mini App URL into a local panel, and it runs inside an iframe against a faithful mock of the Telegram client β€” no phone, no ngrok, no BotFather.

What it gives you:

πŸ”§ Real mock, not a stub. Full window.Telegram.WebApp API surface with cryptographically valid initData (HMAC-SHA-256 signed against your dev bot token). Backend validation passes. Compatible with @telegram-apps/sdk v3 out of the box.

⚑ 5 one-click Quick Scenarios. Premium iOS user β†’ Free Android user β†’ New user with referral param β†’ Group chat launch β†’ Desktop wide viewport. Switch contexts without touching a single input field.

πŸ“Š Bridge event inspector. Every web_app_* call appears in real-time. Group by event type, filter, pause, export logs as .txt. Plus an emit console to fire clientβ†’app events (theme_changed, main_button_pressed, etc.) back into your app.

☁️ CloudStorage editor. Visual key-value editor β€” no more guessing what's stored or manually manipulating localStorage.

πŸ’Ύ Saved presets. Save your current config (platform, user, theme, viewport, bot token) as a named preset. Switch between them in one click. Persists across sessions.

πŸ–₯️ Panel UX. Drag-resize panels (like VS Code), zoomable device stage (25%–200%), mobile notch and desktop traffic lights that react to your platform selection. Import/export config as JSON.

Stack: React 19, TypeScript, Vite, Tailwind CSS, shadcn/ui. Mock script is ~90 KB of zero-dependency vanilla JS.

Testing: 22 Vitest tests covering the base64url codec, config model, wire protocol, and bridge message discrimination.

MIT licensed. Would love some honest feedback β€” and stars if you find it useful ⭐

πŸ”— github.com/Deus-org/tma-devkit

Top comments (0)