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 --include=dev to install frontend dependencies.
  2. Run just reset_db. This creates an empty dev.db, and also creates a base .env file (with DATABASE_URL and RUST_LOG) if one doesn't exist. Run this in every new worktree, as .env and dev.db are not checked into git.
  3. Create a telegram bot by contacting @BotFather and issuing /newbot. (More details). Save its token.
  4. 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.
  5. Add your Telegram settings to the .env file:

    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
    

    FRONTEND_URL is used for the links in Telegram messages, so it only matters if you want to click them.

  6. Optionally, run just reset_db seed to recreate dev.db with seed data. The seeded patients are attached to TELEGRAM_GROUP_ID.

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.