Skip to content

Commit 1e4867e

Browse files
committed
feat: init repo
0 parents  commit 1e4867e

19 files changed

+3806
-0
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_MANIFEST_URL = "http://localhost:3000/ton/tonconnect-manifest.json"

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
37+
38+
certificates

LICENSE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2024-present liect
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
# Telegram Mini Apps Template
3+
4+
Welcome to the Telegram Mini Apps Template repository! This project serves as a comprehensive template for creating Telegram applications using the latest technologies and frameworks. The template includes integration with TonConnect UI and TMA (Telegram Mini Apps), all built on the Next.js framework.
5+
6+
## Features
7+
8+
- **Next.js Framework**: Benefit from the powerful features of Next.js, including server-side rendering and static site generation.
9+
- **TonConnect UI Integration**: Easily connect to the TonConnect ecosystem for seamless user authentication and interaction.
10+
- **Telegram Mini Apps (TMA)**: Build and integrate Telegram Mini Apps with ease, leveraging the power of Telegram's ecosystem.
11+
12+
## Getting Started
13+
14+
### Prerequisites
15+
16+
- Node.js (v14.x or later)
17+
- pnpm (recommended) or npm
18+
19+
### Installation
20+
21+
1. **Clone the repository:**
22+
```bash
23+
git clone https://github.com/liect/tma-nextjs-starter
24+
cd tma-nextjs-starter
25+
```
26+
27+
2. **Install dependencies:**
28+
```bash
29+
# recommended
30+
pnpm install
31+
```
32+
33+
3. **Run the development server:**
34+
```bash
35+
# recommended
36+
pnpm run dev
37+
```
38+
39+
Open your browser and navigate to [http://localhost:3000](http://localhost:3000) to see the application in action.
40+
41+
## Usage
42+
43+
This template provides a basic structure for developing Telegram applications. You can customize the components and styles according to your needs. The template includes sample code for integrating TonConnect UI and TMA, which you can modify and expand upon.
44+
45+
### Environment Variables
46+
47+
The template uses environment variables to store sensitive information and configuration settings. You can create a `.env.local` file in the root directory and add the following variables:
48+
49+
```bash
50+
# TonConnect manifest URL
51+
NEXT_PUBLIC_MANIFEST_URL=YOUR_MANIFEST_URL
52+
```
53+
54+
## Contributing
55+
56+
We welcome contributions from the community! If you have any ideas, suggestions, or improvements, please feel free to submit a pull request or open an issue.
57+
58+
## License
59+
60+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
61+
62+
---
63+
64+
Feel free to customize this template further to match your specific project requirements and details.

app/favicon.ico

17.9 KB
Binary file not shown.

app/globals.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+

app/layout.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { Metadata } from "next";
2+
import "./globals.css";
3+
import { Providers } from './providers';
4+
import { Analytics } from '@vercel/analytics/react';
5+
6+
export const metadata: Metadata = {
7+
title: "TMA Next.js Template",
8+
description: "A Next.js template with TMA.js SDK and TonConnect UI",
9+
};
10+
11+
export default function RootLayout({
12+
children,
13+
}: Readonly<{
14+
children: React.ReactNode;
15+
}>) {
16+
return (
17+
<html lang="zh-CN">
18+
<body>
19+
<Providers>{children}</Providers>
20+
<Analytics />
21+
</body>
22+
</html>
23+
);
24+
}

app/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import User from "@/components/User";
2+
import TonConnect from "@/components/ TonConnect";
3+
4+
export default function Page() {
5+
return (
6+
<div className="flex items-center flex-col gap-2 mt-2">
7+
<TonConnect />
8+
<div>
9+
<User />
10+
</div>
11+
</div>
12+
);
13+
}

app/providers.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"use client";
2+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3+
import { TonConnectUIProvider } from "@tonconnect/ui-react";
4+
import { SDKProvider } from "@tma.js/sdk-react";
5+
6+
const queryClient = new QueryClient();
7+
const manifestUrl = process.env.NEXT_PUBLIC_MANIFEST_URL;
8+
9+
export function Providers({ children }: { children: React.ReactNode }) {
10+
return (
11+
<TonConnectUIProvider manifestUrl={manifestUrl}>
12+
<QueryClientProvider client={queryClient}>
13+
<SDKProvider>{children}</SDKProvider>
14+
</QueryClientProvider>
15+
</TonConnectUIProvider>
16+
);
17+
}

0 commit comments

Comments
 (0)