How misterfrukt3/oborudsh works
Purpose and entry points
Оборудыш is a Telegram Mini App for reserving filming equipment and room 626 at Media BMSTU. The browser client starts at prototype/index.html; its Telegram-facing backend and bot process are combined in bot/main.py. The system is deployed as one production service and one SQLite-backed instance.
Mini App client
The static Mini App provides catalog browsing, reservation flow, navigation, screens, and visual presentation:
• prototype/index.html
• prototype/style.css
• prototype/catalog.js
• prototype/texts.js
It runs inside Telegram Web Apps and calls backend HTTP endpoints. The catalog is also shipped client-side, making the UI catalog a deliberate boundary from server-side availability and reservation enforcement.
API, bot, and authentication boundary
bot/main.py hosts aiohttp API routes and an aiogram 3 Telegram bot in the same Python runtime. It validates Telegram Mini App identity, serves application bootstrap/state, accepts booking-related actions, and handles bot commands such as migration. Telegram is the identity and notification channel; browser requests must cross the Telegram init-data authorization boundary before accessing user-specific data.
Reservation and availability domain
The backend owns booking state, equipment availability, room scheduling, request lifecycle, and conflict prevention. Its central orchestration is in:
• bot/main.py
• bot/equipment.json
• bot/catalog.js
Equipment metadata is maintained as structured catalog data; bot/update_catalog_from_csv.py is the controlled import path for catalog updates. Client and server catalog representations must remain aligned, while the backend remains authoritative for occupied dates and accepted requests.
Persistence and operational jobs
SQLite persistence is embedded in the backend process, storing users, registration-derived fields, reservations, and local accrual data. A scheduler in bot/main.py handles time-based workflow actions, such as reservation lifecycle transitions and notifications. The architecture is intentionally single-instance: production must not run a second bot or database.
External integrations
Telegram Bot API and Mini App runtime are core external dependencies. Google Sheets is optional: registration may be populated from a restricted люди sheet, and accruals can be synchronized while retaining local persistence when Sheets is disabled. Server-sent events from bot/main.py provide real-time client updates where applicable.
Supporting operational interfaces
User-facing Telegram copy is centralized in bot/texts.py. Migration from a legacy button bot is a one-way administrative workflow: it reads the old database directly without changing the new database. Runtime dependencies and environment contract are defined in:
• bot/requirements.txt
• bot/.env.example
• DEPLOY.md
Components 17
Telegram Mini App
- Telegram Mini App runtime · Hosts the browser client and supplies init data.
- Static Mini App · Catalog, navigation, and reservation screens.
prototype/index.html - Client catalog · Shipped UI catalog; not authoritative for availability.
prototype/catalog.js - UI styles and copy
prototype/style.css
Single Python Runtime
One process hosts both the API and Telegram bot.
- API and bot runtime · Combined HTTP API, Telegram bot, and domain entry point.
bot/main.py - Init-data authorization · Validates Telegram identity before user-specific API access.
bot/main.py - Reservations & availability · Enforces conflicts, lifecycle, equipment, and room scheduling.
bot/main.py - Real-time updates
bot/main.py - Lifecycle scheduler · Advances reservations and sends timed notifications.
bot/main.py - Bot copy
bot/texts.py - Server catalog · Authoritative equipment metadata used by backend workflows.
bot/equipment.json - Catalog CSV import · Controlled update path for server catalog data.
bot/update_catalog_from_csv.py
Data & Integrations
- Telegram Bot API · Identity, commands, and user notifications.
- SQLite instance · Stores users, registrations, reservations, and local accruals.
- Google Sheets · Restricted people-sheet lookup and optional accrual synchronization.
- Legacy bot database · Read-only source for one-way administrative migration.
- Production contract · Defines the single-service, single-database deployment model.
DEPLOY.md
Connections 21
- Telegram Mini App runtime → Static Mini App: hosts
- Static Mini App → Client catalog: loads
- Static Mini App → UI styles and copy: uses
- Static Mini App → API and bot runtime: HTTP actions
- Static Mini App → Init-data authorization: sends init data
- Init-data authorization → Reservations & availability: authorizes requests
- API and bot runtime → Reservations & availability: routes actions
- Reservations & availability → SQLite instance: persists state
- Reservations & availability → Server catalog: reads metadata
- Catalog CSV import → Server catalog: updates
- Client catalog → Server catalog: must align
- API and bot runtime → Real-time updates: serves
- Real-time updates → Static Mini App: pushes changes
- Lifecycle scheduler → Reservations & availability: transitions lifecycle
- Lifecycle scheduler → Telegram Bot API: sends notifications
- API and bot runtime → Telegram Bot API: bot commands and identity
- API and bot runtime → Bot copy: formats messages
- API and bot runtime → Google Sheets: optional registration and accrual sync
- API and bot runtime → Legacy bot database: one-way migration reads
- Production contract → API and bot runtime: deploys as one service
- Production contract → SQLite instance: requires one instance