Running and Deploying
The Teleform code is organized as a monorepo, with the following structure:
frontend- frontend app, written in Reactbackend- backend app, written in Golangdocs- this documentation, written on Vitepress
There is two ways to run, deploy and develop Teleform: as a single service with Docker Compose or as a separate frontend and backend.
🐳 With docker-compose (recommended)
Create env file in the project root directory with the following content:
# Bot token from @BotFather
TELEGRAM_BOT_TOKEN=your_token
# Is to skip validation of init_data (useful for testing)
SKIP_INIT_DATA_VALIDATION=false# Bot token from @BotFather
TELEGRAM_BOT_TOKEN=your_token
# Is to skip validation of init_data (useful for testing)
SKIP_INIT_DATA_VALIDATION=falseAfter that, install Docker and use
docker-compose up --builddocker-compose up --buildto run the app. It will be available at localhost:8080 – both the frontend and backend.
This configuration is already suitable for production. Just do the same steps as for running locally, but on your server.
You may wish to make your app available not only on 8080 port, but in 80 or 443. In this case, you can set up reverse proxy like nginx. For example, with such config:
events {}
http {
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:8080;
}
}
}events {}
http {
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:8080;
}
}
}As an alternative, you can just edit compose.yml and change target port.
Running frontend separately
- Install Node.js 18 or higher.
- Change working directory to
frontend(cd frontend) - Run
npm install, thennpm run devto run the app locally. - Run
npm run buildto build the app for production. The result will be infrontend/distdirectory. - Run
npm run serveto serve the app locally atlocalhost:3000.
Running backend separately
- Create
envfile as described above. - Install Golang 1.18 or higher.
- Change working directory to
backend(cd backend) - Place frontend build from
frontend/disttobackend/frontend-builddirectory (it is served from the backend app). - Run
go run main.goto run the app locally.