A good P2E game template is built into the Telegram Mini App. The developed functionality of the game:
- Tapping the duck.
- Buying ducks of different levels.
- Crossing ducks and getting a new level of duck
- Getting a daily reward. Each duck gives a different profit (depending on the level) per minute.
Why is this template better than other P2E templates? The project scales well and is well written.
Important
When launched locally, not via telegram, it will show an error. Since the application implements authorization via @telegram-apps/sdk
-
Log in to ngrok. Installing ngrok in stages.
-
Create .env file. Paste the required variables there -
#Backend BASE_URL. When launching via telegram you need https
REACT_APP_BASE_URL = "http://localhost:3001"
#Default variable
REACT_APP_ENV = production
- Launch the application locally -
cd ./quackup-front
npm install
npm run start
- In a new window, run ngrok in parallel -
ngrok http http://localhost:3000
-
In the window where ngrok is running, copy the Forwarding link (example - https://56d1599d2e12.ngrok.app )
-
Go to Telegram and find the chat bot - @BotFather.
-
Call the command "/new bot" in the chat. Creating a bot.
-
After creating the bot, enter the command - `/setMenuButton". And we set the copied link from point 4 for the button in your bot.
-
Next, go to the created bot and click on the button on the bottom left. Let's go code.
Important
Every time you complete 3 points, a new link will be issued and you need to change it every time @BotFather.
- Create .env file. Paste the required variables there -
# DB Credentials.Required
PORT = 3001
DB_HOST = 'host'
DB_USER = 'username'
DB_PASSWORD = 'password'
DB_DATABASE = 'db name'
#Default variable. Required
NODE_ENV = 'production'
#This is an example. You need get your token for the app via @BotFather in Telegram. Required
BOT_TOKEN = '7084917293:AvAERcJ-hdHd3unL1UyIWalLyxj1ajEuuNfo'
- Launch the backend locally -
cd ./quackup-front
npm install
npm run start