A React-based student grade management system built with TypeScript, Supabase, and Tailwind CSS.
This is a full-stack web application for managing student grades with role-based access control. The system supports two user roles: administrators who can manage students, classes, and grades, and students who can view their own grades.
- Frontend: React 18 with TypeScript
- Backend: Supabase (PostgreSQL database + Auth)
- Styling: Tailwind CSS
- Routing: React Router DOM v7
- Build Tool: Vite
- Icons: Lucide React
The application uses 6 main tables for comprehensive educational management:
- auth.users - Admin accounts only (email + password via Supabase Auth)
- admin_profiles - Admin profile data linked to auth.users
- students - Student accounts (name, username, password_hash) - standalone table
- teachers - Teacher management with active/inactive status
- classes - Course/class definitions with teacher assignments
- tests - Dynamic test definitions (numeric and formula types)
- grades - JSON-based student grades with flexible test storage
- Admins: Email/password authentication via Supabase Auth
- Students: Username/password authentication via direct database lookup
- Role-based access control with separate login methods
- Protected routes based on user types
- Simplified session management
- Manage students (CRUD operations)
- Manage teachers (CRUD operations with active/inactive status)
- Manage classes (CRUD operations with teacher assignments)
- Manage tests (dynamic test creation with formula support)
- Manage grades (CRUD operations with JSON-based storage)
- Manage other admins (admin user management)
- Dashboard with comprehensive statistics
- Brazilian bimestre system support (4-period academic year)
- View personal grades
- Filter grades by year
- Access only to own grade data
src/
├── components/ # Reusable UI components
│ ├── Navbar.tsx # Navigation bar with auth controls
│ └── ProtectedRoute.tsx # Route protection wrapper
├── contexts/ # React contexts
│ └── AuthContext.tsx # Authentication state management
├── hooks/ # Custom React hooks
│ └── useAuth.ts # Authentication hook
├── pages/ # Page components
│ ├── Home.tsx # Landing page
│ ├── Login.tsx # Login/signup page
│ ├── Dashboard.tsx # Main dashboard
│ ├── admin/ # Admin-only pages
│ │ ├── Students.tsx # Student management
│ │ ├── Teachers.tsx # Teacher management
│ │ ├── Classes.tsx # Class management
│ │ ├── Tests.tsx # Dynamic test management
│ │ ├── Grades.tsx # Grade management
│ │ └── Admins.tsx # Admin user management
│ └── student/ # Student-only pages
│ ├── Grades.tsx # Student grade view
│ └── Profile.tsx # Student profile view
├── services/ # API services
│ └── supabase.ts # Supabase client and services
├── types/ # TypeScript type definitions
│ └── index.ts # Main type definitions
└── App.tsx # Main application component
Required environment variables:
VITE_SUPABASE_URL- Your Supabase project URLVITE_SUPABASE_ANON_KEY- Your Supabase anonymous key
npm run dev- Start development servernpm run build- Build for productionnpm run lint- Run ESLintnpm run preview- Preview production build
Current migration files:
supabase/migrations/20250808020000_complete_startup_migration.sql- Complete database schemasupabase/migrations/20250808030000_sample_data.sql- Sample data for testing
Features:
- Complete database schema with 6 tables
- Dynamic test management system
- JSON-based grade storage for unlimited tests
- Formula-based tests with automatic calculations
- Brazilian bimestre system support
- RLS policies for security
- Optimized indexes for performance
Manages authentication state and provides auth methods throughout the app.
Wrapper component that restricts access based on authentication and role requirements.
Centralized API services for:
- Authentication (separate admin/student login methods)
- Students (CRUD operations with username/password)
- Teachers (CRUD operations with active/inactive status)
- Classes (CRUD operations with teacher assignments)
- Tests (dynamic test creation with numeric and formula types)
- Grades (CRUD operations with JSON-based storage)
- Admins (admin user management)
- Uses Supabase Row Level Security (RLS)
- Role-based access control implemented at both frontend and database levels
- Secure authentication with JWT tokens
- Environment variables for sensitive configuration
The application is fully functional with advanced features:
- Dynamic test management through UI
- JSON-based grade storage for unlimited flexibility
- Formula tests with automatic calculation
- Teacher management with active/inactive status
- Brazilian bimestre system (4-period academic year)
- Dashboard customization with test visibility controls
- Primary grade system for main course averages
- School-agnostic design for any educational institution