A React-based video analysis application that integrates with Supabase and AI services for educational livestream recording and analysis. This application helps PE teachers provide real-time feedback to students during physical education activities.
- Live Stream Recording: Capture student performances in real-time
- AI-Powered Analysis: Get instant feedback using Gemini AI for video analysis
- Student/Teacher Modes: Separate interfaces for students and teachers
- Class Management: Create and manage classes with unique join codes
- Performance Tracking: Track student progress over time with detailed analytics
- Session Analysis: Review and analyze recorded sessions with timestamped feedback
- Namelist Upload: Upload class rosters via CSV for easy student management
- Frontend: React 18 + TypeScript + Vite
- Styling: Tailwind CSS with shadcn/ui components
- Backend: Supabase (PostgreSQL database, authentication, edge functions)
- AI Integration: Google Gemini API
- Deployment: Netlify-ready
Before you begin, ensure you have:
- Node.js 18+ installed
- A Supabase account (Sign up here)
- A Google AI API key for Gemini (Get one here)
git clone <your-repo-url>
cd cps-pe-stringsnpm install- Create a new project at supabase.com
- Go to Project Settings → API
- Copy your project URL and anon/public key
-
Copy the example environment file:
cp .env.example .env
-
Open
.envand add your Supabase credentials:VITE_SUPABASE_URL=https://your-project-id.supabase.co VITE_SUPABASE_ANON_KEY=your-supabase-anon-key-here
You'll need to create the following tables in your Supabase database:
teacher_sessions- Stores session informationstudent_analyses- Stores AI analysis resultsclasses- Manages class informationclass_enrollments- Tracks student enrollmentsclass_namelists- Stores class rosters
Run the database migration scripts in your Supabase SQL editor. (Database schema documentation coming soon)
The application uses Supabase Edge Functions for AI analysis:
-
Install the Supabase CLI:
npm install -g supabase
-
Link your project:
supabase link --project-ref your-project-id
-
Set your Google AI API key as a secret:
supabase secrets set GOOGLE_AI_API_KEY=your-gemini-api-key-here -
Deploy the edge functions:
supabase functions deploy gemini-analysis
npm run devThe application will be available at http://localhost:8080
- Push your code to GitHub
- Connect your repository to Netlify
- Configure build settings:
- Build command:
npm run build - Publish directory:
dist
- Build command:
- Add environment variables in Netlify:
- Go to Site Settings → Build & Deploy → Environment Variables
- Add
VITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEY
- Deploy!
The environment variables will be automatically injected during the build process.
src/
├── components/ # React components
│ ├── ui/ # shadcn/ui component library
│ ├── StudentMode.tsx # Student interface
│ ├── TeacherMode.tsx # Teacher interface
│ └── ... # Other components
├── contexts/ # React context providers
├── hooks/ # Custom React hooks
├── lib/ # Utility functions and configs
│ ├── supabase.ts # Supabase client configuration
│ └── ... # Other utilities
├── pages/ # Route components
└── vite-env.d.ts # TypeScript environment definitions
npm run dev- Start development server (port 8080)npm run build- Build for productionnpm run build:dev- Build for developmentnpm run lint- Lint codenpm run preview- Preview production build
/- Main application (Index page)/student/:sessionId- Student mode interface/student/analysis/:sessionId/:studentName- Individual student analysis/class/:classCode- Public class page (student access)/teacher/classes- Teacher's class management/teacher/class/:classId- Individual class page (teacher view)
- The Supabase anon key is safe to expose in client-side code
- Security is enforced through Row Level Security (RLS) policies in Supabase
- Never commit your
.envfile to version control - The service role key should NEVER be used in client-side code
Before going to production, ensure you:
- Enable Row Level Security (RLS) on all tables
- Set up proper authentication rules
- Configure database policies for student/teacher access
- Review and test all security policies
- Set up proper CORS settings in Supabase
- Ensure your
.envfile exists and contains the correct values - Restart the development server after changing
.env
- The
src/vite-env.d.tsfile defines these types - Restart your TypeScript server in your IDE
- Ensure you've set the
GOOGLE_AI_API_KEYsecret in Supabase - Check function logs in the Supabase dashboard
Contributions are welcome! Please open an issue or submit a pull request.
[Add your license here]
For issues and questions, please open an issue on GitHub.