Bigshot1136/SafeSupport
0
<p align="center"> <img src="assets/safesupport-logo.svg" alt="SafeSupport Logo" width="100%" /> </p>
SafeSupport
SafeSupport is an AI-powered support training platform where users practice customer support decisions, get instant grader feedback, and track performance analytics over time.
Key Features
- Real-time support scenario simulation by difficulty (
easy,medium,hard) - Grader feedback with score breakdown and final reward
- Per-user episode history and metrics
- Supabase-authenticated user profiles and analytics
- Dockerized deployment with both backend services running in one container
Project Structure
backend/FastAPI API, environment server, training and analytics routesfrontend/React + Vite applicationassets/branding assets (logo)Dockerfileproduction multi-stage build for frontend + backendstart.shstarts environment server and API server together
Architecture
- Frontend calls API routes under
/api/* - API server processes auth and business logic
- API server calls environment server for reset/grading
- Episode results are persisted in Supabase (
episodes,user_stats,profiles) - Analytics endpoints read aggregated user-specific data
Local Development
Prerequisites
- Python 3.11+
- Node.js 20+
- Supabase project credentials
Backend
cd backendpip install -r requirements.txt- Set environment variables:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEYVITE_SUPABASE_URLVITE_SUPABASE_ANON_KEY- Run services:
uvicorn safesupport_env.server.app:app --host 0.0.0.0 --port 8001 --reloaduvicorn api.main:app --host 0.0.0.0 --port 8000 --reload
Frontend
cd frontendnpm installnpm run dev
Deploy to Hugging Face Spaces (Docker)
This repository is already prepared for Docker Spaces.
Required Variables / Secrets
Set these in Space Settings -> Variables and secrets:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY(Secret)VITE_SUPABASE_URLVITE_SUPABASE_ANON_KEY
How It Runs
- Docker builds frontend assets during image build.
start.shstarts:safesupport_env.server.appon8001(internal)api.main:appon${PORT}(default7860)- API serves frontend static files plus all
/api/*endpoints.
API Highlights
POST /api/training/start?task_type=easy|medium|hardPOST /api/training/stepGET /api/analytics/metricsGET /api/analytics/recentGET /api/users/mePUT /api/users/meGET /health
Troubleshooting
Environment server unavailable: ensure internal env server started successfully.Episode save failedwith RLS: verifyuser_statsINSERT and UPDATE policies exist.401 Session expired: re-login and verify Supabase variables are from the same project.
License
This project is provided for educational and demonstration purposes.
