百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

nextjs-template

> 前端框架
开源

Telegram 迷你应用程序应用程序模板使用 Nex.jst、TypeScript、TON Connect 和 tma.js。

370 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Telegram 迷你应用程序应用程序模板使用 Nex.jst、TypeScript、TON Connect 和 tma.js。

Telegram Mini Apps Next.js Template

This template demonstrates how developers can implement a web application on the Telegram Mini Apps platform using the following technologies and libraries:

  • Next.js
  • TypeScript
  • TON Connect
  • @telegram-apps SDK
  • Telegram UI

The template was created using pnpm. Therefore, it is required to use it for this project as well. Using other package managers, you will receive a corresponding error.

Install Dependencies

If you have just cloned this template, you should install the project dependencies using the command:

bash
pnpm install

Scripts

This project contains the following scripts:

  • dev. Runs the application in development mode.
  • dev:https. Runs the application in development mode using self-signed SSL certificate.
  • build. Builds the application for production.
  • start. Starts the Next.js server in production mode.
  • lint. Runs eslint to ensure the code quality meets the required standards.

To run a script, use the pnpm run command:

bash
pnpm run {script}
# Example: pnpm run build

Create Bot and Mini App

Before you start, make sure you have already created a Telegram Bot. Here is a comprehensive guide on how to do it.

Run

Although Mini Apps are designed to be opened within Telegram applications, you can still develop and test them outside of Telegram during the development process.

To run the application in the development mode, use the dev script:

bash
pnpm run dev

After this, you will see a similar message in your terminal:

bash
▲ Next.js 14.2.3
- Local:        http://localhost:3000

✓ Starting...
✓ Ready in 2.9s

To view the application, you need to open the Local link (http://localhost:3000 in this example) in your browser.

It is important to note that some libraries in this template, such as @telegram-apps/sdk, are not intended for use outside of Telegram.

Nevertheless, they appear to function properly. This is because the src/hooks/useTelegramMock.ts file, which is imported in the application's Root component, employs the mockTelegramEnv function to simulate the Telegram environment. This trick convinces the application that it is running in a Telegram-based environment. Therefore, be cautious not to use this function in production mode unless you fully understand its implications.

Run Inside Telegram

Although it is possible to run the application outside of Telegram, it is recommended to develop it within Telegram for the most accurate representation of its real-world functionality.

To run the application inside Telegram, @BotFather requires an HTTPS link.

This template already provides a solution.

To retrieve a link with the HTTPS protocol, consider using the dev:https script:

bash
$ pnpm run dev:https

▲ Next.js 14.2.3
- Local:        https://localhost:3000

✓ Starting...
✓ Ready in 2.4s

Visiting the Local link (https://localhost:3000 in this example) in your browser, you will see the following warning:

This browser warning is normal and can be safely ignored as long as the site is secure. Click the Proceed to localhost (unsafe) button to continue and view the application.

Once the application is displayed correctly, submit the link https://127.0.0.1:3000 (https://localhost:3000 is considered as invalid by BotFather) as the Mini App link to @BotFather. Then, navigate to https://web.telegram.org/k/, find your bot, and launch the Telegram Mini App. This approach provides the full development experience.

Deploy

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out the Next.js deployment documentation for more details.

Useful Links

  • Platform documentation
  • @telegram-apps/sdk-react documentation
  • Telegram developers community chat

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptnextjstypescript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架