Telegram Web K includes several built-in debugging aids: URL query parameters that switch the app into special modes, globally accessible class instances you can inspect in DevTools, a snapshot server for capturing and restoring state, and a structured logger. Source maps are included in production builds so that stack traces point to readable TypeScript rather than minified output.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/TelegramOrg/Telegram-web-k/llms.txt
Use this file to discover all available pages before exploring further.
Query parameters
Append these parameters to any app URL to change its runtime behaviour. They work in both local development (http://localhost:8080/) and in production (https://web.telegram.org/k/).
Enable test data centres
Connect to Telegram’s test environment instead of production DCs. Test accounts and test bots live here.
Enable verbose logging
Turn on detailed debug output from the MTProto networker, managers, and workers. Logs appear in the browser console with coloured prefixes.
Disable the Shared Worker
Run the worker logic in a plain
Worker instead of a SharedWorker. This gives you a single unified DevTools context — useful when you want to set breakpoints inside manager code without navigating between separate worker panels.Force HTTP transport
Force the MTProto transport layer to use HTTPS long-polling instead of WebSockets. Useful for testing in network environments that block WebSocket connections.
Global console bindings
Many internal objects are mounted towindow (or the global scope of the relevant worker) so you can inspect them directly in DevTools without adding any code. The mounting is controlled by MOUNT_CLASS_TO from src/config/debug.ts.
Notable globals available on the main thread:
| Name | What it is |
|---|---|
rootScope | The global event bus and app context (src/lib/rootScope.ts) |
appImManager | The active chat / IM manager |
apiManagerProxy | The main-thread proxy that routes calls to the Shared Worker |
Globals are only mounted in development builds by default. In production,
MOUNT_CLASS_TO resolves to an empty object unless you have enabled debug mode with ?debug=1.Icon library preview
To see every SVG icon available in the app, call the globalshowIconLibrary() function from the browser console:
Source maps in production
Source maps are included in the production build. When you open DevTools onhttps://web.telegram.org/k/ and navigate to Sources, you will see the original TypeScript file paths. Stack traces in the Console also resolve to TypeScript line numbers automatically.
This means you can debug production issues the same way you would debug locally — set breakpoints, watch variables, and step through the original source.
Snapshot server
The snapshot server at./snapshot-server/ is a small Node.js app that lets you capture a complete dump of the browser’s localStorage and IndexedDB, save it to disk, and restore it later. This is useful for:
- Reproducing a specific app state reliably across restarts.
- Sharing a reproducible state with another developer.
- Regression testing with a known-good baseline.
Read the README
Check
./snapshot-server/README.md for setup and usage instructions specific to your environment.Take a snapshot
With the app open in your browser, follow the snapshot server’s UI to capture the current localStorage and IndexedDB state.
Logger system
src/lib/logger.ts provides a structured logger used throughout the codebase. Each logger instance has a named prefix (e.g., 'MTPROTO', 'SW', 'MP-main') and supports log levels:
?debug=1 is active, LogTypes.Debug messages become visible. In production without the debug flag, only warnings and errors are shown.
Network statistics
src/lib/mtproto/networkStats.ts tracks per-data-centre byte counts for both sent and received MTProto traffic. Access it from the Shared Worker’s global context or via DevTools when using ?noSharedWorker=1:
Debugging the Shared Worker
In Chrome, openchrome://inspect/#workers to attach DevTools to the Shared Worker directly. You can set breakpoints in manager code, inspect the appManagersManager state, and watch MTProto traffic in real time.
In Firefox, open about:debugging#/runtime/this-firefox and find the Shared Worker under “Workers”.