A role-based school event management platform built with Next.js + Supabase.
Teachers create events, delegate other teachers, manage student applicants, and control registration windows.
Admins approve accounts and manage user records.
Students discover events and apply when eligible.
- Role-based app for
student,teacher, andadmin - Event creation with:
- class range filters
- spots needed
- event date
- selection/registration cutoff date
- Applicant workflow:
- apply
- select
- unselect
- reject
- Delegation:
- event owner can delegate approved teacher accounts
- delegated teachers can manage applicants
- Registration controls:
- teacher can stop and reopen registrations
- Security-first architecture:
- Supabase Auth sessions (JWT in HTTP-only cookies)
- server actions for protected mutations
- validation + authorization checks
- RLS policies for delegation table
- Frontend: Next.js App Router, React, Tailwind CSS
- Backend: Supabase (Postgres + Auth + RLS)
- Auth: Supabase Auth via
@supabase/ssr - Types: TypeScript
SchoolEventHandler/
├─ README.md
└─ school-event-portal/
├─ src/
│ ├─ app/ # routes, server actions, API search routes
│ ├─ components/ # UI + feature components
│ ├─ lib/ # auth, supabase, events, validation, search
│ ├─ hooks/ # reusable hooks
│ └─ types/ # domain types
├─ supabase/migrations/ # SQL migration files
├─ SECURITY.md # security notes
└─ .env.example # env template- Browse eligible open events
- View detailed event page
- Apply while registration is open
- Track application status
- Create and manage events
- Search applicants and students
- Select/unselect/reject applicants
- Delegate approved teacher accounts to co-manage an event
- Stop/reopen registration
- Approve/reject student accounts
- Edit user account fields (name/email/password/role/etc.)
- Permanently delete accounts
Students can apply only when all conditions are true:
- Event status is
open - Current date is on/before
selection_date(if set) - Student class falls within event class range
Teachers can manually stop registration by changing event status to closed.
- Node.js 20+
- npm
- A Supabase project
cd school-event-portal
npm installCreate school-event-portal/.env.local:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
# Required for admin user management and enhanced search fallback
SUPABASE_SERVICE_ROLE_KEY=your-service-role-keyKeep
SUPABASE_SERVICE_ROLE_KEYserver-only. Never expose it to client code.
Open Supabase SQL Editor and run:
supabase/migrations/001_event_collaborators_selection_date.sqlsupabase/migrations/002_profiles_staff_search_rls.sqlsupabase/migrations/003_delegate_teachers_only.sql
npm run devApp runs at: http://localhost:3000
npm run build
npm run lintSee school-event-portal/SECURITY.md for full details.
Quick summary:
- Session/auth checks in middleware + server guards
- Role and ownership authorization in server actions
- Input validation on IDs, emails, dates, and text
- Database-backed permissions for collaborator operations
- Security headers set in middleware
- Create event
- Add preparation criteria in description
- Set selection date and class range
- Optionally delegate other teachers
- Monitor applicants and finalize selections
- Approve pending students
- Manage user roles and profile data
- Reset credentials when needed
- Delete accounts when required
- Ensure migration
002is applied - Ensure target users have role
teacherand statusapproved - Check
.env.localfor correct Supabase values
- Ensure migration
001exists in DB - Ensure migration
003is applied (teacher-only delegation policy)
- Verify
SUPABASE_SERVICE_ROLE_KEYis set correctly
- Audit log for registration/delegation changes
- Email notifications for status updates
- Rich analytics for event performance
- Bulk student imports
Private school project. Add an explicit license if you plan to distribute publicly.