Skip to content

Latest commit

 

History

History
65 lines (54 loc) · 1.71 KB

File metadata and controls

65 lines (54 loc) · 1.71 KB

Local Development & Setup Guide

Want to run FoodShot locally to test it or record a demo? Here is the full setup:

Prerequisites

  • Docker and Docker Compose
  • Taskfile (go-task)
  • Python 3.11+
  • Poetry
  • Cloudflare Tunnel (cloudflared) or ngrok (for exposing local webhook, optional)

1. Configuration

git clone <repo_url> && cd foodshot
cp .env.example .env

Edit .env and fill in your keys (Telegram Token, OpenAI, etc.).

2. Start the Application

You can start the app in two ways: Webhook mode or Polling mode.

Option A: Polling Mode (Easiest for local dev)

Start the database and Redis, then run the bot locally via polling:

task install
task poll

Option B: Webhook Mode

Start dependencies and FastAPI locally:

task install
task dev

Then expose the webhook using a tunnel (like Cloudflare):

task tunnel

Copy the public https:// URL generated by your tunnel and update .env:

WEBHOOK_URL=https://<your-tunnel-url>/webhook

Restart the bot (task dev), and it will automatically register the new webhook URL with Telegram.

3. Database Migrations

Don't forget to run migrations to initialize your database tables:

task db:migrate

Useful Commands

FoodShot uses Taskfile for common operations:

  • task lint / task format — run Ruff linter/formatter.
  • task test — run pytest test suite.
  • task db:makemigrations "message" — create a new Alembic migration.
  • task ops — launch the interactive Operations TUI Console.
  • task broadcast — broadcast release updates to users.

Testing

We maintain rigorous tests for critical components, especially the medical math:

task test