§01
Overview
- What it is: a Telegram bot for food ordering/delivery for Restaurant chain (UZ) (and Restaurant chain (UZ) — shared code). Full conversational order flow on Telegraf scenes, an Elysia REST API for external triggers (notifications/locations/scheduling), task queues, multilingual UI.
- Type / status / role: bot · maintained (last commit 2025-07-10) · lead — user is the principal author: ~139 of 265 commits (Davron Yuldashev 59 + Davron 37 + Davr 34 + Davr@iMac 6 + Dave93 3); co-developers — the Salim brothers (shahaa 78 + Shahzod 10) and others.
- Activity period: 2021-12-08 → 2025-07-10 — ~3.5 years, a long-lived production bot.
§02
Stack
- Languages: TypeScript (new code,
src/) + JavaScript (legacy,controllers/) — hybrid codebase mid-migration to TS. - Frameworks/libraries: Bun (runtime); Telegraf 4 + scenes (
telegraf-i18n,@telegraf/session,telegraf-session-redis/-local); Elysia.js (API + Swagger + CORS + Eden); MongoDB (driver 4); Redis (ioredis) for sessions; Bull + BullMQ (+ bull-board) queues; Sentry (error tracing); prom-client / express-prometheus-middleware (Prometheus metrics); barcode generation (bwip-js, canvas, bardcode); schedulers (node-cron, agenda, sfn-scheduler); luxon; winston; cheerio; string-similarity. - Infra/deploy: PM2 (
pm2.config.js), webhook mode in prod, build viabun build --target bun. Three lockfiles (bun/yarn/npm). - Data: MongoDB (
lesailes_bot), Redis (sessions + queues), external APIapi.restaurant-chain.uz. - Notable tooling: Redis-session migration/inspection scripts (
scripts/*.cjs), health/queue_info endpoints.
§03
What was shipped
139 authored commits over 3.5 years (per diffs/messages):
- Conversational order flow: scenes
start,startOrder,menu,myOrders,review,settings,callback(src/scenes/); myOrders refactor to TS (06346a2, −1197 deletion of legacy helpers;3ac66eeflow control + session reset on/start). - Delivery business logic: delivery pricing (
d653fcd,f3d5a1b), weight (02eef03), payment types (85824d1), pickup (35829c8), pricing fixes (4117fdd). - API: reply-to-message (
a1cff3d), schedule_event/send_notify/send_location/queue_info/health (Elysia). - Infra maturity: transition to Redis sessions (separate README_REDIS_SESSIONS.md + migrate scripts), Bull queues, Prometheus metrics, Sentry, 3-language i18n.
- 2025-07 refactor: JS→TS migration, improved error handling and imports (
697379a), server binary moved to .gitignore. - Scope: 265 commits; stable multi-year evolution (v2.0.0).
§04
Technical challenges
Per architecture (CLAUDE.md/package.json) and diffs (user-authored — primary committer):
- Adaptive session storage (LocalSession in dev → Redis in prod, fallback to in-memory on Redis outage; migration scripts JS→Redis). → Production-grade dialog-state management at scale.
- Task queues (Bull/BullMQ + bull-board) for delayed notifications/broadcasts (
schedule_event,send_notify) — separating the bot from background processing. → Queue-based architecture. - Observability: Prometheus metrics (prom-client) + Sentry tracing in a Telegram bot — a level of maturity uncommon for bots.
- Hybrid JS→TS migration on a live production bot without a rewrite from scratch (scenes are progressively moved to
src/scenes/). → Tech-debt management. - 3-language i18n via telegraf-i18n with language stored in session; barcode generation for orders (bwip-js/canvas).
- Caveat: per CLAUDE.md "errors are often swallowed", no tests — a typical production bot with tech debt.
- Matches the user's known experience: Telegraf Scenes/WizardScene, Bull+Redis, MongoDB, i18n.
§05
AI-assisted development
- Sessions found: 0 (the Claude Code sessions directory for this project is absent; verified via full-path normalization). Local
.claude/+CLAUDE.md(in Russian) exist → AI assistance likely without sessions recorded here. - What was done with AI: no transcripts; CLAUDE.md is structured for Claude Code.
- AI workflow patterns: documentation structured for AI, but no direct sessions in this directory.
§06
Achievements & metrics
- Production Telegram bot for a major delivery brand (Restaurant chain (UZ)/Restaurant chain (UZ)), v2.0.0, ~3.5 years in operation.
- 7 conversational scenes, REST API, queues, metrics, 3 languages, Redis sessions.