How raiyaxkrash/zapisflow works
ZapisFlow is a multitenant SaaS for beauty-service bookings and studio management through Telegram bots. Clients enter through a tenant bot, browse services and available slots, then create a booking and handle its deposit; masters manage bookings and studio operations in the same bot. A platform manager bot provisions tenant bots and subscriptions. Webhook intake, tenant routing, persistence, and scheduled work support these user-facing flows. README documents the overall architecture; several domain handlers and background jobs are represented by their tree paths because their source was not sampled.
Main entry points: booking.py Client booking flows · appointments.py Master admin CRM · app.py Webhook ingestion · bot_registry.py Tenant bot registry
Components 26
Bot Runtime
- Webhook ingestion
app/web/app.py - Tenant bot registry
app/services/bot_registry.py - Shared bot dispatcher
app/bot/bot_instance.py - Tenant context
app/bot/middlewares/tenant_context.py
Platform Management
- Platform manager bot
app/manager_bot/handlers.py - Bot provisioning
app/services/bot_provisioning_service.py - Token encryption
app/core/token_crypto.py - Subscription lifecycle
app/services/subscription_service.py
Client Booking
- Client booking flows
app/bot/handlers/client/booking.py - Service catalog
app/bot/handlers/client/services.py - Availability calculation
app/services/slot_engine.py - Booking lifecycle
app/services/booking_service.py - Client deposit flow
app/bot/handlers/client/payment.py - Appointments and portfolio
app/bot/handlers/client/my_appointments.py
Studio Management
- Master admin CRM
app/bot/handlers/admin/appointments.py - Schedule management
app/bot/handlers/admin/calendar_mgmt.py - Payment review
app/bot/handlers/admin/payments.py - Business analytics
app/bot/handlers/admin/analytics.py - Client broadcasts
app/services/broadcast_service.py
Persistence and Jobs
- Scheduled jobs
app/scheduler/scheduler.py - Booking reminders
app/scheduler/jobs/reminder_worker.py - Data repositories
app/repositories/appointment_repository.py - PostgreSQL data
app/database/session.py - Redis services
Other components
- Telegram users
- Telegram API
Connections 28
- Telegram users → Webhook ingestion: sends updates
- Webhook ingestion → Tenant bot registry: resolves tenant bot
app/web/app.py - Webhook ingestion → Platform manager bot: routes manager updates
- Tenant bot registry → Shared bot dispatcher: provides bot
- Shared bot dispatcher → Tenant context: establishes tenant
- Tenant context → Client booking flows: routes client updates
- Tenant context → Master admin CRM: routes admin updates
- Platform manager bot → Bot provisioning: provisions bots
app/manager_bot/handlers.py - Bot provisioning → Token encryption: protects bot tokens
app/services/bot_provisioning_service.py - Platform manager bot → Subscription lifecycle: manages subscriptions
app/manager_bot/handlers.py - Client booking flows → Service catalog: browses services
- Client booking flows → Availability calculation: requests availability
- Client booking flows → Booking lifecycle: creates booking
- Booking lifecycle → Data repositories: persists booking
- Client booking flows → Client deposit flow: continues to deposit
- Client booking flows → Appointments and portfolio: views appointments
- Master admin CRM → Schedule management: manages schedule
- Master admin CRM → Payment review: reviews deposits
- Master admin CRM → Business analytics: reviews performance
- Master admin CRM → Client broadcasts: sends broadcasts
- Scheduled jobs → Booking reminders: runs reminder jobs
app/scheduler/jobs/reminder_worker.py - Booking reminders → Data repositories: loads booking data
app/scheduler/jobs/reminder_worker.py - Scheduled jobs → PostgreSQL data: uses database
- Scheduled jobs → Redis services: coordinates jobs
- Data repositories → PostgreSQL data: reads and writes
- Webhook ingestion → Redis services: deduplicates updates
app/web/app.py - Tenant bot registry → PostgreSQL data: loads bot records
app/services/bot_registry.py - Tenant bot registry → Telegram API: uses bot sessions