A modern template for creating Telegram Mini Apps games using TypeScript, React, and Phaser. This template provides a solid foundation with all the necessary tooling and configuration to quickly start developing your own TMA game.
- Phaser 3 - Popular and powerful HTML5 game framework
- React - For building user interfaces and menus
- TypeScript - Type safety and better developer experience
- Telegram Mini Apps SDK - Deep Telegram integration
- MongoDB - For storing game data and user progress
- Docker - Containerized development and deployment
- Webpack - Modern bundling and development setup
- SSL Support - Built-in SSL configuration for production
- Set up environment variables:
cp envs/.env.example envs/.env
Edit envs/.env
and add your Telegram Bot Token and other required variables.
- Start development environment:
make dev
The game will be available at https://localhost:4000
.
├── frontend/ # Frontend code
│ ├── src/ # Source files
│ │ ├── components/ # React components (UI elements, menus)
│ │ ├── game/ # Phaser game files
│ │ │ ├── scenes/ # Game scenes
│ │ │ ├── objects/ # Game objects and entities
│ │ │ └── config.ts # Phaser configuration
│ │ ├── styles/ # SCSS styles for React components
│ │ ├── App.tsx # Main React component
│ │ └── main.tsx # Entry point
│ ├── assets/ # Game assets (images, sounds)
│ └── index.html # HTML template
├── server/ # Backend code
│ └── src/ # Source files
│ ├── bot/ # Telegram bot handlers
│ ├── models/ # MongoDB models
│ └── index.ts # Server entry point
├── envs/ # Environment configurations
├── docker/ # Docker configurations
└── dist/ # Compiled code
make dev
- Start development environmentmake prod
- Start production environmentmake down
- Stop all containers
Run inside the app
container:
npm run build
- Build both client and servernpm run build-client
- Build client onlynpm run build-srv
- Build server onlynpm run watch-client
- Watch for changes in client
- Set up environment variables:
cp envs/.env.example envs/.env
Edit envs/.env
and add your Telegram Bot Token and other required variables.
- Start production environment:
make prod
Contributions are welcome! Please feel free to submit a Pull Request.
If you find this template useful, consider supporting me:
TON: UQA2f2i0-2tKoQU9qPcq30QZq4Cr_fdat0G-k-00ES6029LV