This repository contains a sample application that integrates with the Telegram platform using React for the frontend and Node.js for the backend. The project demonstrates how to set up a Telegram mini app with routing, state management, and backend API integration.
- Frontend: Built with React, utilizing the Telegram SDK for UI components and state management.
- Backend: Developed with Node.js and Express, providing API endpoints for the application.
- Node.js (version 20.18 or later)
- Yarn package manager
-
Navigate to the backend directory:
cd backend
-
Install dependencies:
yarn install
-
Build the project:
yarn build
-
Start the server:
- For development:
yarn dev
- For production:
yarn start:prod
- For development:
-
Docker Setup (optional):
- Build the Docker image:
docker build -t sample-telegram-backend .
- Run the Docker container:
docker run -p 3005:3005 sample-telegram-backend
- Build the Docker image:
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
yarn install
-
Start the application:
yarn start
-
Docker Setup (optional):
- Build the Docker image:
docker build -t sample-telegram-frontend .
- Run the Docker container:
docker run -p 3000:3000 sample-telegram-frontend
- Build the Docker image:
- Access the frontend application at
http://localhost:3000
. - The backend API is available at
http://localhost:3005
.
- Routing: Managed using React Router, with a simple structure defined in
routes.tsx
. - State Management: Utilizes Telegram SDK hooks for managing app state and launch parameters.
- Dark Mode: Automatically adjusts the UI based on Telegram's dark mode settings.
- Platform Adaptation: Adjusts UI components based on the user's platform (iOS, macOS, etc.).
express
: Web framework for Node.js.@openfort/openfort-node
: OpenFort SDK for backend integration.dotenv
: Loads environment variables from a.env
file.
react
: JavaScript library for building user interfaces.@telegram-apps/sdk-react
: SDK for integrating with Telegram mini apps.