This project is a starter for building Telegram Mini Apps using Next.js.
https://t.me/mini_app_starter_bot/app
-
Install dependencies:
pnpm install
-
Create a bot in Telegram (via @BotFather and using the command
/newbot
). -
Set the
TG_API_TOKEN
in.env
to the API token of your bot. -
Configure a publicly accessible URL to your local machine using ngrok or cloudflare tunnel. If your public URL is http instead of https, refer to the docs to turn on test environment.
-
Configure the bot using @BotFather and the command
/newapp
. Use the public URL you configured in the previous step as the "App link". This step will let you choose an App name, it can be used with the bot url to directly open the app. e.g.https://t.me/{bot_name}/{app_name}
. -
Configure the bot's menu button to point to the mini app's URL.
-
Run the development server:
pnpm dev
-
Open the mini app via either the Mini App's URL or the clicking on the menu button in the bot.