The app is available at https://t.me/memowordsbot/app
This is a Telegram mini-app designed to help you memorize English words using a simplified version of the SM2 algorithm for spaced repetition. Words will appear at varying frequencies based on how well you're able to remember them.
See apps/memowords-backend/src/learning/learning.service.ts
for details on how the algorithm works.
Use BotFather to perform the following steps:
- Create a new bot
- Create web app
- For local development, use
https://memobot.dmku.local/
as URL for the app - Setup menu button to open web app. For local development, use
https://memobot.dmku.local/
- Docker
- Docker Compose
- Node.js (version 20 or higher)
- Yarn
Since telegram requires to use HTTPS,
we need to configure it for local development using Caddy container.
The configuration file for Caddy is located in Caddyfile.dev
file.
First create a volumes for Caddy and Postgres
docker volume create memowords-caddy-data
docker volume create memowords-pg-data-local
Then run the following command to start Caddy and Postgres containers
docker-compose -f docker-compose.dev.yaml up -d
Run frontend (Mini App)
cd apps/quiz-mini-app
yarn dev
Go to backend directory apps/memowords-backend
and create .env
file with the following variables:
TELEGRAM_BOT_TOKEN=<your telegram bot token>
Prepare database
cd apps/memowords-backend
yarn schema:sync
yarn migration:up
Run backend
cd apps/memowords-backend
yarn start:dev
Follow the instructions in Caddy documentation to set up certificates for local development.
Then add domain name memobot.dmku.local
to your /etc/hosts
file or use any local DNS server.
Before running the bot, you need to create a .env
file in the root directory of the project. This file should contain the following variables:
TELEGRAM_BOT_TOKEN=<your telegram bot token>
ACCESS_TOKEN_SECRET=<your access token secret>
POSTGRES_PASSWORD=<your postgres password>
Create a volume for the postgres database:
docker volume create memowords-pg-data
Create a network to connect the app and upstanding web server:
docker network create memowords
To run the bot, execute the following command:
docker-compose up -d
This configuration implies that you have a web server running on the host machine that proxies requests to the bot and terminates TLS. For example, you can use Caddy for this purpose.
Use network memowords
to connect your web server to the bot.
Bot will be available at http://memowords-entrypoint:3000
inside the network.
With Caddy you can use the following configuration:
<your domain> {
reverse_proxy memowords-entrypoint:3000
}
And Caddy will automatically generate and renew certificates for your domain using Let's Encrypt.