How ashigaevanjelin/beauty_tech_ai works
Purpose and Runtime
Beauty Tech AI is a Flask-based salon platform combining role-specific workflow management with AI-oriented beauty analysis, recommendations, and hairstyle preview. It runs as a Python web server from app.py, targets the runtime specified in .python-version/runtime.txt, and serves a built frontend bundle from static/index.html and static/assets/.
Application Composition
app.py is the backend composition and launch point: it initializes Flask, loads application configuration, database support, and route modules. config.py centralizes runtime/database configuration. The primary persistence boundary is SQLite, with the committed local database at instance/beautypassport.db.
Identity and Role Segmentation
Authentication and role-aware access are handled through routes/auth.py. The product has customer, salon-staff, and salon-owner experiences; dashboard selection and role-specific aggregate views are exposed through routes/dashboards.py. This is the key authorization boundary before customers access personal beauty data or appointments and staff/owners access operational data.
Domain Persistence Model
models.py defines the application’s persistent domain layer, expected to represent users, beauty-passport/analysis information, service recommendations, and appointment/business records. Route handlers use this layer rather than treating the frontend bundle as a source of state. SQLite is suitable for the current single-instance deployment model but is a material scaling boundary for concurrent hosted use.
Customer Beauty Passport and Analysis
routes/passport.py owns the digital Beauty Passport flow: customer beauty-analysis results and generated reports become durable, customer-scoped records. AI/image-oriented processing is supported by process_realistic_hair.py; source hairstyle imagery is organized under assets/hairstyles. OpenCV and ML-related dependencies are expected through requirements.txt, creating a native/image-processing runtime boundary.
Recommendations and Hairstyle Experience
routes/recommendations.py provides personalized salon-service, home-care, and beauty guidance based on passport/analysis data. routes/hairstyle.py serves the virtual hairstyle try-on and face/hairstyle suitability workflow, using bundled/static assets plus the hair-processing pipeline. fix_assets.py is an asset-preparation utility associated with this visual-processing boundary.
Appointment Operations and Analytics
routes/appointments.py manages the booking lifecycle: customer requests, staff assignment/confirmation, completion, and status visibility. Those operational records feed owner/staff dashboard metrics in routes/dashboards.py, including bookings, revenue, customer activity, trends, and service popularity. The control flow is customer booking → staff fulfillment/status updates → owner aggregate reporting.
Client and Deployment Boundary
The browser client is a prebuilt static application at static/index.html, with hashed JavaScript/CSS artifacts in static/assets/; Flask supplies its API and static hosting surface. Deployment is compatible with the documented hosted Render instance, but no separate frontend server, external identity provider, payment processor, or cloud AI service is represented in the repository tree.
Main entry points: app.py Flask application · models.py Domain persistence model · dashboards.py Role dashboards · appointments.py Appointment operations
Components 16
Flask backend
- Flask application · Initializes configuration, persistence, routes, API, and static hosting.
app.py - Runtime configuration
config.py - Domain persistence model · Defines users, passports, recommendations, appointments, and business records.
models.py
Route modules
- Authentication & roles · Authorization boundary for customers, staff, and owners.
routes/auth.py - Role dashboards · Provides role-specific operational and aggregate views.
routes/dashboards.py - Beauty Passport · Persists customer-scoped analysis results and reports.
routes/passport.py - Recommendations · Generates personalized services, home-care, and beauty guidance.
routes/recommendations.py - Virtual hairstyle try-on · Serves hairstyle suitability and preview workflows.
routes/hairstyle.py - Appointment operations · Manages booking, assignment, fulfillment, and status.
routes/appointments.py
Visual AI pipeline
- Hair image processor · OpenCV/ML-oriented realistic hair processing.
process_realistic_hair.py - Hairstyle source images
assets/hairstyles - Asset preparation · Prepares visual assets for hairstyle processing.
fix_assets.py - Native ML dependencies · Provides the native and image-processing runtime boundary.
requirements.txt
Other components
- Browser client · Prebuilt client for customer and salon workflows.
static/index.html - Frontend assets
- SQLite database · Single-instance persistence and concurrent-hosting scaling boundary.
instance/beautypassport.db
Connections 21
- Browser client → Flask application: API requests
- Browser client → Frontend assets: loads bundle
- Flask application → Frontend assets: hosts
- Flask application → Runtime configuration: loads
- Flask application → Authentication & roles: registers
- Flask application → Role dashboards: registers
- Flask application → Beauty Passport: registers
- Flask application → Recommendations: registers
- Flask application → Virtual hairstyle try-on: registers
- Flask application → Appointment operations: registers
- Authentication & roles → Role dashboards: authorizes roles
- Beauty Passport → Domain persistence model: stores analysis
- Recommendations → Domain persistence model: uses passport data
- Virtual hairstyle try-on → Hair image processor: runs preview processing
- Hair image processor → Hairstyle source images: uses source imagery
- Asset preparation → Hairstyle source images: prepares
- Hair image processor → Native ML dependencies: requires
- Appointment operations → Domain persistence model: updates booking lifecycle
- Appointment operations → Role dashboards: feeds operational metrics
- Role dashboards → Domain persistence model: aggregates records
- Domain persistence model → SQLite database: persists