A tutoring portal demo with a React (Vite) frontend and Supabase (Auth + Postgres) backend. The homepage is a 3D scene built with React Three Fiber, while the dashboards are lightweight Tailwind UIs (Students / Parents / Teachers) with weekly calendar views (react-big-calendar).
- Frontend: Vite + React SPA (3D Home + dashboards). Embedded email/password login + signup via Supabase Auth.
- Database: Supabase Postgres with RLS policies and RPC functions for safe, atomic booking.
- Backend: ASP.NET Core API for privileged/admin operations (role approval, seeding teacher availability). Uses the Supabase service role key server-side only.
- Create Supabase project and copy your project URL + anon key.
- In Supabase SQL editor, run
supabase/schema.sql. - Configure auth confirmation policy in Supabase:
- Dev: disable email confirmation for faster iteration.
- Prod: enable email confirmation; the UI will show a “check your email” state on signup until the user verifies and signs in.
- Create a local
.envbased on.env.example. - Install and run the frontend:
npm installnpm run dev
- Signup collects a requested role (
student,parent,teacher). This is stored asprofiles.requested_role. profiles.roleis not client-writable; it must be approved by an admin.- Until approved, the UI shows “Pending approval” instead of dashboards.
The .NET backend is used for admin actions and must be configured with:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY(server-side only)ADMIN_API_KEY(simple header check for dev)
Examples (dev):
- Approve role (uses
requested_rolewhenroleis omitted):POST http://localhost:4000/admin/approve-rolewith headerX-Admin-Key: <ADMIN_API_KEY>and JSON{ "userId": "<uuid>" }
- Link parent to student:
POST http://localhost:4000/admin/link-parent-studentwith JSON{ "parentId": "<uuid>", "studentId": "<uuid>" }
- Seed teacher availability:
POST http://localhost:4000/admin/seed-availabilitywith JSON{ "teacherId": "<uuid>" }
Parents book sessions by calling the Postgres RPC function book_slot(...) via supabase.rpc.
The function enforces:
- parent/student linkage (
parent_students) - atomic booking (locks availability row)
- teacher + student conflict checks