No description
The 20260521120000_neat_eat_split migration backfilled step_bucket + workout_frequency from the old activity_level column silently. Users whose onboarding pre-dates that schema change deserve a one-line heads-up that their TDEE/calorie norm got more accurate and they can fine-tune the inputs on /calories. Script is opt-in: dry-run by default, --send actually messages. Filter intentionally restricts to users with both NEAT and EAT buckets set (implies they came from the backfill path or set them themselves) AND onboarding completed before 2026-05-21 (the migration date). Стрим 5, task 5.6. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| prisma | ||
| scripts | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .env.example | ||
| .env.qa.example | ||
| .gitignore | ||
| .prettierignore | ||
| .prettierrc | ||
| CLAUDE.md | ||
| docker-compose.prod.yml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| eslint.config.js | ||
| package-lock.json | ||
| package.json | ||
| prisma.config.ts | ||
| README.md | ||
| tsconfig.json | ||
| tsconfig.test.json | ||
| vitest.config.ts | ||
| vitest.integration.config.ts | ||
Workout Bot
Personal Telegram bot for tracking workouts and daily steps. See ../docs/spec.md for the product spec.
Prerequisites
- Node.js LTS (≥ 22.x)
- Docker + Docker Compose (for local Postgres and Redis)
- A Telegram bot token from @BotFather
Local setup
cp .env.example .env # then put your BOT_TOKEN in
docker compose up -d # start postgres and redis (DB only)
npm install
npm run migrate # apply Prisma migrations
npm run dev # start the bot (long polling)
npm run worker # in a second terminal: BullMQ worker
Locally docker compose runs only Postgres and Redis. The bot and worker
run on the host via npm run dev / npm run worker so code changes pick
up without rebuilds. The production app container lives in
docker-compose.prod.yml for VPS deploys
(docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d).
The HTTP /health endpoint is available at http://localhost:3001/health once the bot process is up.
Scripts
| Command | What it does |
|---|---|
npm run dev |
Bot in watch mode (tsx). |
npm run worker |
BullMQ worker in watch mode. |
npm run build |
Type-check and emit to dist/. |
npm start |
Run the compiled bot (dist/index.js). |
npm run migrate |
prisma migrate dev. |
npm run migrate:deploy |
prisma migrate deploy (production). |
npm test |
Vitest. |
npm run lint |
ESLint. |
npm run format |
Prettier. |
Project layout
src/
├── bot/ # grammY composers, command handlers, dialogs
├── domain/ # pure business logic (no I/O)
├── infra/ # adapters: db, telegram, queue, time
├── jobs/ # BullMQ producers and consumers
├── config/ # env parsing (zod), feature flags
├── i18n/ # string catalogs (ru only on v1)
├── lib/ # generic utilities
└── index.ts # bot entrypoint
prisma/
└── schema.prisma
tests/
docker-compose.yml
.env.example