Skip to main content

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.

Telegram Web K uses pnpm as its package manager (enforced via a preinstall hook — npm install and yarn will not work). Before you begin, make sure you have Node.js 18+ and pnpm 9+ installed. You will also need a Telegram API ID and hash, which you can get for free from my.telegram.org in under a minute.
Prerequisites:
  • Node.js 18 or higher
  • pnpm 9.15 or higher (npm install -g pnpm)
  • A Telegram account to obtain API credentials

Local setup

1

Clone the repository

Clone Telegram Web K from GitHub and enter the project directory:
git clone https://github.com/TelegramOrg/Telegram-web-k.git
cd Telegram-web-k
2

Install dependencies

Install all dependencies with pnpm. The preinstall script enforces pnpm, so other package managers will fail immediately:
pnpm install
3

Configure your API credentials

Obtain a Telegram API ID and hash from my.telegram.org:
  1. Log in with your Telegram phone number.
  2. Go to API development tools.
  3. Create a new application — the name and platform can be anything.
  4. Copy your App api_id and App api_hash.
Then create your local environment file. The .env.local.example file is empty by default; Vite will auto-copy it to .env.local on first run, but you can create it manually:
cp .env.local.example .env.local
Open .env.local and set your credentials:
VITE_API_ID=your_api_id_here
VITE_API_HASH=your_api_hash_here
Do not commit .env.local to version control. It contains your personal API credentials. The file is listed in .gitignore by default.
4

Start the development server

Start Vite in development mode with hot module replacement:
pnpm start
The server starts on http://localhost:8080 by default. The terminal will show the local URL once the build completes.
5

Open the app in your browser

Navigate to http://localhost:8080 and sign in with your Telegram account. The dev server includes source maps and live reload — changes to TypeScript and SCSS files are applied without a full page refresh.

Available scripts

The following scripts are defined in package.json:
ScriptCommandDescription
startpnpm startStart the Vite dev server with HMR on port 8080
buildpnpm buildGenerate changelog then produce a minified production build in public/
servepnpm serveBuild then serve the production build with Node.js
testpnpm testRun the Vitest test suite
lintpnpm lintLint all TypeScript files under src/ with ESLint
generate-changelogpnpm generate-changelogRegenerate the changelog from commit history
generate-iconspnpm generate-iconsRebuild the icon font from IcoMoon sources
watch-langpnpm watch-langWatch and apply language pack changes during development

Running in Docker

Docker is the recommended approach when you want a clean, reproducible environment or when you are preparing a production image.

Development with Docker

1

Install dependencies in a container

docker-compose up tweb.dependencies
2

Start the dev container

docker-compose up tweb.develop
Open http://localhost:8080 in your browser.

Production with Docker

1

Start the production nginx container

docker-compose up tweb.production -d
Open http://localhost:80 in your browser.
2

Build a custom Docker image (optional)

To build a portable production image you can push to Docker Hub:
docker build -f ./.docker/Dockerfile_production \
  -t your-username/telegram-web-k:latest .

Debugging query parameters

Append these query parameters to the local URL to change the client’s behavior at runtime. They are parsed by src/config/modes.ts on page load.
ParameterExample URLEffect
test=1http://localhost:8080/?test=1Connect to Telegram’s test data centers instead of production
debug=1http://localhost:8080/?debug=1Enable verbose logging in the browser console
noSharedWorker=1http://localhost:8080/?noSharedWorker=1Disable the Shared Worker — useful for inspecting network calls per tab
noServiceWorker=1http://localhost:8080/?noServiceWorker=1Disable the Service Worker — helpful when debugging push or caching issues
http=1http://localhost:8080/?http=1Force HTTPS transport for MTProto instead of WebSocket
Combine parameters with &: http://localhost:8080/?test=1&debug=1 connects to test DCs with full logging enabled.

Taking local storage snapshots

The snapshot-server mini-app in the repository lets you export and import the client’s local storage and IndexedDB state. This is useful for reproducing bugs without needing the original account. See ./snapshot-server/README.md for usage instructions.

Next steps

Configuration

All environment variables, app config fields, and runtime modes explained.

Architecture

How workers, managers, and the MTProto layer fit together.

Debugging

Dev tools, global class bindings, icon library preview, and snapshot server.

Docker deployment

Build and run production Docker images for self-hosting.

Build docs developers (and LLMs) love