§01
Overview
- What it is: A multilingual (ru/uz/en) Telegram e-commerce bot for a restaurant chain. The user places an order (delivery or pickup), picks a branch, goes through OTP authorization, views their orders, gets a cashback barcode, leaves reviews. The bot is a frontend to an external Laravel API (
api.restaurant-chain.uz); it doesn't store the catalog itself, but proxies and orchestrates. - Type / status / role: bot / maintained / contributor (repo owned by
ShahzodSalimsakov; user is one of 2–3 main developers, ~50% of commits). - Active period: first commit 2021-12-08, last 2026-05-18. A long-lived workhorse: edits arrive in waves driven by business changes (delivery fees, payment types, enabling/disabling cashback).
§02
Stack
- Languages: JavaScript (Node.js, CommonJS). TypeScript only in devDependencies — effectively unused (sources are
.js). - Frameworks/libraries: Telegraf 4 (Scenes / WizardScene + Composer as a dialog state machine), telegraf-i18n (ru/uz/en), Fastify 3 + fastify-telegraf (webhook), Bull 4 + @bull-board (queues and admin UI), ioredis, luxon (dates/timezones), hashids (tg_id obfuscation), bwip-js / barcode (barcode generation), axios, lodash.
- Infra/deploy: PM2 (
pm2.config.js, apples_bot), webhookhttps://newbot.restaurant-chain.uz, Sentry (@sentry/node), Contabo server (vmi849112.contaboserver.net/choparpizza.uz). Dev — polling + local session. - Data: MongoDB (telegraf-session-mongodb for sessions,
event_systemscollection for tracking sent messages), Redis (Bull broadcast queue + pub/sub). - Notable tooling: agenda (scheduler, disabled in code), node-cron / sfn-scheduler / cron-converter (partially commented out — traces of iterations on broadcast scheduling).
§03
What was shipped
The user's commit messages are mostly junk ("asd", "asdf", "dsds", "sdsd"), so milestones are reconstructed from diffs and code, not commit text.
- Order flow (delivery/pickup) —
controllers/startOrder: WizardScene with steps address → building → entrance, geocoding via API, nearest terminal lookup, branch selection. - Branch working-hours calculation —
startOrder/index.js(luxon), including overnight shifts and weekday/weekend logic. - Menu and cart —
controllers/menu/index.js(~79 KB, bot core): category pagination, cart, OTP authorization, minimum order amount. - Cashback with barcode —
controllers/cashback: code128 generation (bwip-js) from the phone number, PNG sent to the chat. - Mass broadcasts —
bot.js+util/queue.js: Bull queue with repeatable cron jobs, progress reported back to Laravel API, cancellation of active jobs via Redis pub/sub. - Business updates: delivery prices/weights (
d653fcd,f3d5a1b,02eef03), payment types (85824d1,4d1d9f5 removed payment type uzcard,03fbbb5 turn off payment links), enabling/disabling cashback (1373664 cashback disabled,232b9b9), languages/locales. - Latest milestone (`b4f848f`, 2026-05-18): clean refactor — replaced runtime fetch of
/api/configs/public(with base64 decode) with a staticutil/config.jsfrom env. The only commit with a human-readable description and Co-Authored-By: Claude Opus 4.7. - Volume: 257 commits total, 129 by the user (Davron Yuldashev
yul.davron.93@gmail.com, aliases Davron/Davr/Dave93), over ~4.5 years. Co-authors:shahaa(Shahzod Salimsakov, owner, 89 commits),root(deploy).
§04
Technical challenges
- Custom Bull queue with cross-process job cancellation (
util/queue.js):ExtendedQueue extends Queue+ExtendedJob, tracking active job promises, cancellation via Redis pub/sub (getInternalEventEmitter) with a direct reference to Bull GitHub issues (#1056/#1067) as justification for working around the sandboxed-process limitation. → Demonstrates understanding of distributed task processing and infrastructure-level workarounds at the queue layer. The most non-trivial piece of code in the repo. - Broadcast with backpressure reporting (
bot.jssendQueue.process): sequential delivery over a list oftg_ids, checking job state at each step (cancellation on the fly), POSTing progress to the API every 50 messages, removing sent messages on aremovedevent via theevent_systemscollection. → Real-world handling of Telegram rate limits and broadcast state. - Branch working-hours logic across midnight (
startOrder/index.js:169–234, luxon): current time compared to open/close, day correction whenclose.hour < open.hour(overnight shifts), separate branches for weekdays/weekends. → Careful edge-case handling of dates/timezones (Asia/Tashkent). - OTP authorization (
menu/index.js): hashids-encodingtg_id, assembling a bearer token (base64 OTP_TOKEN + random salt → hex), resending the code. → Custom signing scheme for backend requests. - Refactor `b4f848f` (
util/config.js):parsePositiveIntpreserving historical behavior (fallback 0 on NaN, explicitly commented). → A rare example of clean, deliberate code in the project.
§05
AI-assisted development
- Sessions found: 0 (no local Claude Code sessions directory for this project).
- What was done with AI: indirect trace — the last commit
b4f848fis taggedCo-Authored-By: Claude Opus 4.7 (1M context). This is the only clean, documented commit in the repository (config refactor), which contrasts with the rest of the history and points to a one-off use of AI for cleaning up legacy code. - AI-workflow patterns: insufficient data for conclusions (one data point).
- No full Claude Code sessions exist for this project.
§06
Achievements & metrics
- Real production product: bot for an active food-delivery chain (
newbot.restaurant-chain.uz), 3 interface languages, integration with Laravel API, MongoDB, Redis, Sentry, PM2. - 129 user commits over ~4.5 years of maintenance (2021–2026) — a long-lived product, not a prototype.
- Functionality: delivery/pickup ordering, geocoding, nearest-terminal lookup, OTP authorization, cashback barcode, reviews, scheduled mass broadcasts with progress.
- No exact business metrics (DAU, order counts) in the code.