Installation
The tma CLI is the primary tool for creating, developing, and deploying Telegram Mini Apps on TMA.sh.
Install the CLI
Section titled “Install the CLI”Install the CLI globally with Bun:
bun add -g @tma.sh/cliVerify the installation:
tma --versionLog in to your account
Section titled “Log in to your account”-
Run the login command:
Terminal window tma loginThis opens your browser and starts an OAuth device code flow. Authorize the CLI to connect it to your TMA.sh account.
-
Once authorized, credentials are stored locally. You only need to do this once per machine.
Create a new project
Section titled “Create a new project”Use tma init to scaffold a new project from a template:
tma init my-appThe interactive prompt walks you through:
- Template selection — pick a framework (Vite React, Vite Vue, Vite Svelte, or Plain HTML).
- API routes — optionally scaffold a
server/api/index.tsfile for edge API routes powered by Hono. - Bot handlers — optionally set up bot command and message handlers.
- Dependency installation — automatically runs
bun installwhen scaffolding completes.
After init finishes, your project is ready to develop:
cd my-apptma devLink an existing project
Section titled “Link an existing project”If you already have a frontend project and want to deploy it to TMA.sh, run tma link from the project root:
cd my-existing-apptma linkThis prompts you to select an org and project, then writes the .tma/project.json config file to connect your local directory to your TMA.sh account.
Project configuration
Section titled “Project configuration”After tma init or tma link, a .tma/project.json file is created in your project root.
tma init creates a partial config with only the project name:
{ "projectName": "my-app"}tma link creates the full config with all fields:
{ "projectId": "proj_abc123", "orgId": "org_xyz789", "projectName": "my-app"}This file identifies the project when running CLI commands. Commit it to your repository so that deployments work from CI and other machines.
Set up your Telegram bot
Section titled “Set up your Telegram bot”Every TMA.sh project is connected to a Telegram bot. If you do not have one yet, create it now.
-
Open Telegram and start a conversation with @BotFather.
-
Send
/newbotand follow the prompts to choose a name and username. -
Copy the bot token that BotFather gives you. You will need it when connecting your project.
-
Run
tma bot registerand paste the token when prompted:Terminal window tma bot registerTMA.sh configures the bot’s Web App URL automatically on each deployment.
Next steps
Section titled “Next steps”Your CLI is installed, your account is connected, and your project is ready. Head to Your First Deploy to ship your first Telegram Mini App.