How mashta-lilia/handwriter works
Handwritter is a web application for creating and downloading realistic handwritten documents, with Telegram OTP authentication. The main user journey is account registration and verification, then editing typed text and generating a canvas result for export. The README also documents login, password recovery, saved-document history, and generation progress over SSE. Authentication implementation is sampled; generation, history, and parts of the frontend API are not, so those links are documented or marked unverified rather than inferred from imports.
Main entry points: register.py Auth endpoints · App.tsx Page routing · recovery.py Recovery endpoints · telegram.py Telegram delivery
Components 30
Web application
- Page routing
frontend/src/App.tsx - Registration
frontend/src/pages/RegisterPage.tsx - OTP verification
frontend/src/pages/VerifyRegistrationPage.tsx - Login
frontend/src/pages/LoginPage.tsx - Password recovery
frontend/src/pages - Auth state
frontend/src/store/authStore.ts - Handwriting editor
frontend/src/pages/EditorPage.tsx - Rich text input
frontend/src/components/ui/RichEditor.tsx - Canvas renderer
frontend/src/components/canvas/HandwritingCanvas.tsx - Editor state
frontend/src/store/editorStore.ts
Authentication
- Auth endpoints
backend/api/auth/register.py - Recovery endpoints
backend/api/auth/recovery.py - Auth schemas
backend/schemas/auth.py - Account and tokens
backend/services/auth/token_service.py - User queries
backend/api/auth/crud.py - Password and JWT
backend/api/auth/security.py - OTP service
backend/services/auth/otp_service.py
Document generation
- Generation API
backend/api/generate.py - Generation worker
backend/worker/tasks.py - Saved documents
backend/api/history.py - Canvas result
Persistence and integrations
- Telegram delivery
backend/services/auth/telegram.py - Bot webhook
backend/api/telegram/webhook.py - Service dependencies
backend/dependencies/services.py - Redis OTP store
backend/core/redis_client.py - User records
backend/models/user.py - SQL database
backend/core/database.py
Other components
- User
- Telegram Bot API
- Image storage
Connections 41
- User → Page routing: uses
- Page routing → Registration: routes to
frontend/src/App.tsx - Page routing → OTP verification: routes to
frontend/src/App.tsx - Page routing → Login: routes to
frontend/src/App.tsx - Page routing → Password recovery: routes to
frontend/src/App.tsx - Page routing → Handwriting editor: routes to
frontend/src/App.tsx - Registration → Auth endpoints: starts registration
- OTP verification → Auth endpoints: submits OTP
- Login → Auth endpoints: authenticates
- Password recovery → Recovery endpoints: requests reset
- Auth endpoints → Auth schemas: validates with
backend/api/auth/register.py - Recovery endpoints → Auth schemas: validates with
backend/api/auth/recovery.py - Auth endpoints → Service dependencies: resolves services
backend/api/auth/register.py - Recovery endpoints → Service dependencies: resolves services
backend/api/auth/recovery.py - Service dependencies → OTP service: provides
backend/dependencies/services.py - Service dependencies → Telegram delivery: provides
backend/dependencies/services.py - Service dependencies → Account and tokens: provides
backend/dependencies/services.py - Auth endpoints → OTP service: verifies OTP
backend/api/auth/register.py - Auth endpoints → Telegram delivery: sends code
backend/api/auth/register.py - Auth endpoints → Account and tokens: activates account
backend/api/auth/register.py - Recovery endpoints → OTP service: verifies OTP
backend/api/auth/recovery.py - Recovery endpoints → Telegram delivery: sends code
backend/api/auth/recovery.py - Recovery endpoints → Account and tokens: updates password
backend/api/auth/recovery.py - Account and tokens → User queries: queries users
backend/services/auth/token_service.py - Account and tokens → Password and JWT: hashes and signs
backend/services/auth/token_service.py - User queries → User records: reads and writes
backend/api/auth/crud.py - User records → SQL database: maps records
backend/models/user.py - OTP service → Redis OTP store: stores OTP
backend/services/auth/otp_service.py - Telegram delivery → Redis OTP store: reads chat ID
backend/services/auth/telegram.py - Bot webhook → Telegram delivery: records chat ID
backend/api/telegram/webhook.py - Telegram delivery → Telegram Bot API: sends messages
backend/services/auth/telegram.py - Handwriting editor → Rich text input: renders
frontend/src/pages/EditorPage.tsx - Handwriting editor → Canvas renderer: renders
frontend/src/pages/EditorPage.tsx - Handwriting editor → Editor state: uses state
- User → Generation API: starts generation
- Generation API → Generation worker: queues job
- Generation API → Canvas result: streams progress and result
- Canvas result → Canvas renderer: renders words
- Canvas result → Image storage: references images
- User → Saved documents: lists documents
- Saved documents → Canvas result: returns saved schema