Skip to content

Development Setup

Prerequisites

  1. Install Rust
  2. Install just (cargo install just)
  3. Install Node.js (version 20.19.0+ or 22.12.0+)
  4. Install sqlx-cli (cargo install sqlx-cli)
  5. Install pre-commit (apt install pre-commit or pip install pre-commit)
  6. Run pre-commit install

Setup

  1. In the frontend directory, run npm install to install frontend dependencies.
  2. Create a telegram bot by contacting @BotFather and issuing /newbot. (More details). Save its token.
  3. Create a telegram group for testing, and invite your bot to it. Get the group ID (it's a negative number) by sending /help to that group.
  4. Create a file named .env with the following contents:

    DATABASE_URL=sqlite:dev.db
    RUST_LOG=info,trufotbot=trace
    TELOXIDE_TOKEN=YOUR_BOT_TOKEN_HERE
    TELEGRAM_GROUP_ID=TESTING_GROUP_ID_HERE
    TRUFOTBOT_ALLOWED_USERS=YOUR_USERNAME_HERE
    FRONTEND_URL=http://localhost.localdomain:5173
    
  5. Run just reset_db seed to create dev.db with seed data, or just reset_db for an empty database.

Running

just serve_both

Or run backend and frontend separately in parallel:

just serve_backend
just serve_frontend_with_proxy

Browse to http://localhost:5173

Documentation

To serve the documentation site locally:

just docs-serve

The site will be available at http://127.0.0.1:8000.