metadata
title: mbok_dev
emoji: 🔐
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
mbok_dev
Public gateway with Supabase authentication that dynamically loads the private ver20 application from DLPO/habadashi Space.
Features
- Supabase email/password authentication
- Cookie-based session management
- Dynamic loading of private application code (source code not exposed in public repo)
- Role-based access control via profiles table
Environment Variables (Set in HF Space Secrets)
SUPABASE_URL: Your Supabase project URLSUPABASE_KEY: Your Supabase anon/service keyHF_TOKEN: Hugging Face token with access to privateDLPO/habadashiSpaceOPENAI_KEY: OpenAI API key (required by ver20)CLIENTPOOL: Client pool configuration (required by ver20)
Architecture
- User visits public Space
- Bootstrap downloads ver20 from private
DLPO/habadashiSpace - User logs in with Supabase credentials
- On successful login, ver20 Gradio app is mounted at
/app/ - User profile and organization info loaded from
profilestable
Startup Phase Logging
The application logs structured startup phases to help diagnose issues. Look for these phase markers in the logs:
Expected Startup Sequence
[STARTUP_META]- Environment and configuration info[PHASE] bootstrap_start- Begin downloading private app[PHASE] bootstrap_end success=true- Private app downloaded[PHASE] supabase_init_start- Initialize Supabase client[PHASE] supabase_init_end success=true- Supabase ready[PHASE] fastapi_init_start/end- FastAPI app created[PHASE] create_ui_start/end- Login UI created[PHASE] import_ver20_start- Import ver20 app[PHASE] import_ver20_end success=true- Ver20 loaded[PHASE] mount_login_start/end- Login UI mounted[PHASE] mount_app_start/end- Ver20 app mounted[STARTUP_COMPLETE]- All phases complete
Health Check Endpoint
Once started, check the health endpoint:
curl https://DLPO-mbok-dev.hf.space/healthz
Expected response:
{
"ok": true,
"ver20_loaded": true,
"private_app_dir": "./private_app"
}
Debugging Startup Failures
If the Space fails to start or restarts repeatedly:
- Check the last phase reached in logs
- Look for
[ERROR]and[TRACEBACK]markers after the last phase - Common failure points:
bootstrap_end success=false- HF_TOKEN missing or invalidsupabase_init_end success=false- SUPABASE_URL/KEY missingimport_ver20_end success=false- Ver20 app.py structure issue- No phases after
mount_app_end- Port binding or health check issue
Request Logging
All HTTP requests are logged with:
[REQUEST]- Incoming request (method, path)[RESPONSE]- Response status and duration
Example:
[REQUEST] method=GET path=/
[RESPONSE] method=GET path=/ status=307 duration=0.015s