Getting started
Installation
Install Bun (recommended), scaffold with create-teact or the teact CLI, and add @teactjs packages to an existing project.
Prerequisites
- Bun (recommended for
bun dev/ HMR) or Node 20+ if you use npm/pnpm. - A Telegram bot token from @BotFather.
New project (recommended)
bun create teact my-bot
cd my-botThe wizard asks for:
- Project name (if not passed as
my-bot) - Template — Starter, Showcase, Counter, or Empty
- Features — storage, conversations, streaming, auth, i18n, payments (varies by template)
- Package manager —
bun,npm, orpnpm - Install dependencies — usually yes
Then add your token to .env:
# .env
TELEGRAM_BOT_TOKEN=123456:ABC-DEF...Start development:
bun devCLI equivalents
If you install the CLI globally or use bunx:
teact create my-bot
teact dev
teact buildSee CLI for all commands (generate, doctor, flags).
Existing project
Add the core engine, the components package, and the Telegram adapter:
bun add @teactjs/core @teactjs/ui @teactjs/telegramOptional add-ons: @teactjs/storage (persistence), @teactjs/plugin-sdk (author plugins), @teactjs/testing (dev/test).
Import components (Message, Button, InlineKeyboard, …) from @teactjs/ui. Import
createBot, the router, hooks, and defineConfig from @teactjs/core. The old
@teactjs/react, @teactjs/runtime, and @teactjs/renderer packages no longer exist — they were
folded into @teactjs/core.
Verify
teact doctor— environment and project checks.- Send
/startto your bot afterbun dev— you should see your root component or router home route.