A multilingual Telegram Mini App featuring a winter-themed racing game where players control a sleigh to avoid falling snowflakes. Built with Python, JavaScript, and MySQL.
- Interactive sleigh racing game with smooth controls
- Progressive difficulty system
- Real-time score tracking
- Responsive canvas-based graphics
- Winter-themed visual elements
- Multi-language support (English and Russian)
- Telegram Bot integration
- User data tracking and analytics
- Secure database storage
- Responsive design for all devices
- Theme-aware UI (follows Telegram theme)
- Python 3.8+
- Flask (Web Server)
- python-telegram-bot
- SQLAlchemy (ORM)
- MySQL (Database)
- HTML5 Canvas
- JavaScript (ES6+)
- CSS3
- Telegram Web App API
TelegramNYmini_app/
├── .env # Environment configuration
├── bot.py # Telegram bot handler
├── database.py # Database models and interactions
├── server.py # Flask web server
├── requirements.txt # Project dependencies
├── translations/ # Localization files
│ ├── bot/ # Bot translations
│ │ ├── en.json
│ │ └── ru.json
│ └── webapp/ # Web app translations
│ ├── en.json
│ └── ru.json
└── webapp/ # Mini App frontend
├── index.html
├── game.js
├── gameEngine.js
├── translations.js
└── styles.css
- Python 3.8 or higher
- MySQL Server
- Telegram Bot Token (from @BotFather)
- HTTPS-enabled domain for hosting (required for Telegram Mini Apps)
- Clone the repository:
git clone https://github.com/yourusername/TelegramNYmini_app.git
cd TelegramNYmini_app
- Install Python dependencies:
pip install -r requirements.txt
-
Create a MySQL database
-
Configure environment variables in
.env
:
BOT_TOKEN=your_bot_token_here
WEBAPP_URL=your_webapp_url_here
DB_HOST=localhost
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=telegram_miniapp
- Initialize the database:
python database.py
- Start the Flask server:
python server.py
- In a separate terminal, start the Telegram bot:
python bot.py
- Use LEFT and RIGHT arrow keys to control the sleigh
- Avoid colliding with falling snowflakes
- Score points by surviving longer
- Game ends on collision with a snowflake
The app automatically detects the user's language from their Telegram settings and displays content in either English or Russian. To add a new language:
- Create new translation files in:
translations/bot/[language_code].json
translations/webapp/[language_code].json
- Follow the existing translation file structure
- Add the language code handling in
translations/bot_translator.py
- Set up a local development environment:
python server.py --debug
- For hot-reloading of frontend changes:
# If using a development server like live-server
live-server webapp
- Python: Follow PEP 8 guidelines
- JavaScript: ES6+ standards
- Use meaningful variable and function names
- Add comments for complex logic
- Keep functions small and focused
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
- Never commit sensitive data (tokens, passwords)
- Use environment variables for configuration
- Implement rate limiting for API endpoints
- Validate all user input
- Keep dependencies updated
- The repository includes a
.gitignore
file that prevents sensitive data from being committed. Never manually override these settings. - Sensitive files that should NEVER be committed:
.env
files with environment variables- Configuration files with secrets
- API tokens or credentials
- Database credentials
- Private keys or certificates
- Always use environment variables for sensitive data
- Review your commits before pushing to ensure no sensitive data is included
- If you accidentally commit sensitive data:
- Change all exposed credentials immediately
- Contact repository maintainers
- Consider using git-filter-branch to remove sensitive data from history
This project is licensed under the MIT License - see the LICENSE file for details.
- Telegram Team for the Mini Apps platform
- Python Telegram Bot community
- All contributors and testers
For questions and support, please open an issue in the GitHub repository or contact the maintainers directly.
Made with ❤️ for Telegram Mini Apps