Class Access is a comprehensive digital solution designed to help teaching academies and individual tutors manage their classes, students, payments, attendance, and communications efficiently, all in one place. This platform aims to streamline administrative tasks, allowing educators to focus more on teaching.
Experience Class Access firsthand with the demo account:
- Website: https://classaccess.tech
- Email:
[email protected] - Password:
demouser
- Tech Stack & Architecture
- Technical Features & Learning Experiences
- Core Features
- Database Schema & Row Level Security
- Getting Started
- Deploy on Vercel
- Contact
Class Access is built using a modern, robust, and scalable technology stack:
- Next.js 14: Utilized as a full-stack React framework, leveraging features like the App Router for server and client components, API routes for backend logic, server-side rendering (SSR), and static site generation (SSG) where applicable, ensuring optimal performance and SEO.
- React 18: The core library for building a declarative, component-based, and interactive user interface. Employs functional components and React Hooks (e.g.,
useState,useEffect,useContext, custom hooks) for state management and side effects. - JavaScript (ES6+) & JSX: The primary programming language for frontend and backend logic, utilizing modern JavaScript features and JSX syntax for React components.
- Supabase: A comprehensive Backend-as-a-Service (BaaS) platform providing:
- PostgreSQL Database: A powerful open-source relational database for storing all application data, including user profiles, class information, student records, attendance, payments, and invoices. Leverages Supabase's managed PostgreSQL offering with built-in extensions.
- Authentication: Supabase Auth handles secure user sign-up, login (email/password), and OAuth 2.0 integration with providers like Google and Zoom. Manages JWT sessions and user identities.
- Storage: (If used, e.g., for profile pictures or uploaded documents - not explicitly detailed in provided files but a common Supabase feature).
- Realtime: (If used, e.g., for live updates - not explicitly detailed but available).
- Edge Functions: (If used for serverless functions - not explicitly detailed but available).
- Admin SDK: Utilized within Next.js API routes for performing privileged database operations and administrative tasks that require bypassing Row Level Security (RLS), using the
SUPABASE_SERVICE_KEY.
- Next.js API Routes: Serve as the backend endpoints for custom business logic, data validation, secure interaction with the Supabase database (often using the Admin SDK), and orchestrating calls to third-party services.
- Tailwind CSS: A utility-first CSS framework enabling rapid UI development, responsive design, and a consistent styling system through pre-defined utility classes. Configured via
tailwind.config.js. - Shadcn/ui: A collection of re-usable, accessible, and aesthetically pleasing UI components built on top of Radix UI and styled with Tailwind CSS. Key components used include
Button,Dialog,Card,Table,Input,Select,Toast,Calendar,Popover,DropdownMenu,Checkbox,Avatar,Badge,Textarea,Separator,ScrollArea, andRadioGroup. - Framer Motion: A React animation library used to create fluid transitions, micro-interactions, and engaging user experiences throughout the application, particularly on the landing page and for UI element state changes.
- Lucide React: Provides a comprehensive library of clean, consistent, and customizable SVG icons used across the application to enhance visual communication.
- Email Delivery:
- Brevo (formerly Sendinblue): Integrated via its REST API for sending various transactional emails, including welcome messages, account activation links, password reset instructions, invoices, and attendance reports with PDF attachments.
- Video Conferencing Platforms:
- Google Meet: Integrated using the Google Calendar API and Google OAuth 2.0. Allows teachers to authenticate their Google account and give the app permissions to dynamically generate unique Google Meet links for their classes.
- Zoom: Integrated using the Zoom API and OAuth 2.0. Enables teachers to connect their Zoom accounts, create meeting links, and manage API access/refresh tokens securely.
- Payment Processing:
- UPI (Unified Payments Interface): Facilitates payments by generating UPI QR codes (using
qrcode.react) and constructing UPI intent URLs. This allows students to make direct payments using their preferred UPI apps.
- UPI (Unified Payments Interface): Facilitates payments by generating UPI QR codes (using
- PDF Generation:
- @react-pdf/renderer: A React library used for generating PDF documents on the client-side. Implemented for creating professional-looking attendance reports and invoices that can be downloaded or emailed.
- Security & Authentication:
- JWT (JSON Web Tokens): Handled by Supabase Auth for user sessions. Custom JWT verification (
jsonwebtokenlibrary) is implemented in API routes to protect endpoints and authorize requests. - Cryptr: A library used for symmetric encryption/decryption of sensitive data, specifically for securing third-party OAuth tokens (Google, Zoom) before they are stored in the database.
- JWT (JSON Web Tokens): Handled by Supabase Auth for user sessions. Custom JWT verification (
- Phone Number Utilities:
libphonenumber-js: Used within the customPhoneInputcomponent for parsing, formatting, and validating international phone numbers, enhancing data quality for user profiles.
- Date & Time Management:
date-fns: Utilized for date formatting and manipulation, particularly in UI components like calendars and date pickers.moment-timezone: Employed for handling complex timezone conversions and date/time calculations, essential for scheduling classes across different timezones and for backend processes like cron jobs.
- Vercel: The primary platform for deployment, continuous integration/continuous deployment (CI/CD), global hosting, and managing serverless cron jobs (defined in
vercel.json) for scheduled backend tasks. - ESLint: Configured with
next/core-web-vitalspreset for static code analysis, enforcing code style, and identifying potential errors to maintain high code quality. - Custom Utilities:
fetchTimeout: A custom wrapper around the nativefetchAPI to implement request timeouts, preventing indefinite hangs and improving application resilience when dealing with external services.
- HTTP Client:
- Axios: A promise-based HTTP client used for certain backend API interactions, particularly for handling the Zoom OAuth token exchange and API calls due to its features like automatic JSON data transformation and error handling.
- Analytics & Monitoring:
- Vercel Analytics & Speed Insights: Built-in Vercel tools for monitoring website traffic, performance metrics, and Core Web Vitals.
- Umami: A self-hostable or cloud-based privacy-focused web analytics solution used for tracking user interactions and site usage.
- Microsoft Clarity: A user behavior analytics tool providing heatmaps, session recordings, and insights into how users interact with the application, aiding in UI/UX improvements.
This project showcases the implementation of various advanced web development concepts and features, demonstrating proficiency in full-stack development and system design:
-
Full-Stack Application Development with Next.js & Supabase:
- Accomplishment: Architected and developed a multi-functional platform for educational institutions, seamlessly integrating a React-based frontend (Next.js App Router) with a robust backend (Next.js API Routes) and a Supabase BaaS.
- Skills Demonstrated & Learnings:
- Database Design & Management: Designed and implemented a normalized PostgreSQL schema on Supabase, modeling complex relationships between teachers, students, classes, attendance, payments, and invoices. Utilized JSONB fields for flexible data structures like
classes_leftandstatusper class. - Frontend Development: Built responsive, interactive, and component-driven user interfaces using React 18, functional components, and advanced Hook patterns. Leveraged Shadcn/ui and Tailwind CSS for rapid and consistent UI development.
- Backend Development: Developed secure and efficient server-side logic using Next.js API Routes to handle business operations, data validation, and communication with Supabase (utilizing the Admin SDK for privileged actions).
- Next.js Mastery: Gained in-depth experience with Next.js features including Server Components, Client Components, file-system routing, dynamic routing, and various data fetching strategies (SSR, CSR, and server actions if applicable).
- Supabase Integration: Proficiently used Supabase client libraries for CRUD operations, user authentication, and managing database interactions from both client and server, including implementing Row Level Security.
- Database Design & Management: Designed and implemented a normalized PostgreSQL schema on Supabase, modeling complex relationships between teachers, students, classes, attendance, payments, and invoices. Utilized JSONB fields for flexible data structures like
-
Advanced Third-Party API Integration & Secure OAuth 2.0 Management:
- Accomplishment: Integrated Google Meet, Zoom, and Brevo APIs to provide core functionalities like video conferencing and automated email communications.
- Skills Demonstrated & Learnings:
- OAuth 2.0 Implementation: Successfully implemented the Authorization Code Grant flow for Google and Zoom, including handling OAuth callbacks, securely exchanging authorization codes for access and refresh tokens, and managing token lifecycles.
- Secure Token Management: Engineered a secure system for storing sensitive OAuth tokens by encrypting them using
Cryptrbefore database persistence and decrypting them on demand for API calls, significantly enhancing security. - Token Refresh Strategy: Implemented logic to automatically refresh expired access tokens for Google and Zoom using their respective refresh tokens, ensuring uninterrupted service.
- Transactional Email Service Integration: Leveraged Brevo's API to send various types of automated emails (welcome, account activation, password resets, invoices, attendance reports), including dynamic content and PDF attachments.
-
Robust Authentication, Authorization & User Lifecycle Management:
- Accomplishment: Developed a comprehensive user authentication system supporting multiple roles (teacher, student) and secure access control through Supabase Auth and custom JWT verification.
- Skills Demonstrated & Learnings:
- Multi-Factor Authentication (if applicable) & OAuth: Utilized Supabase Auth for core email/password authentication and integrated Google OAuth for teacher sign-in.
- Custom User Flows: Designed and implemented complete user lifecycle management, including account activation via email, secure password reset mechanisms, and linking external OAuth identities to user accounts.
- API Security (JWT): Secured all custom API endpoints by implementing JWT verification middleware, ensuring that only authenticated and authorized users can access protected resources.
-
Automation through Scheduled Tasks & Cron Jobs:
- Accomplishment: Implemented automated daily email reminders for teachers regarding their upcoming class schedules using Vercel Cron Jobs.
- Skills Demonstrated & Learnings:
- Serverless Scheduling: Configured and deployed cron jobs using Vercel's infrastructure (
vercel.json) to trigger specific Next.js API routes at predefined intervals. - Timezone-Aware Logic: Utilized
moment-timezonefor accurate date and time calculations, ensuring cron jobs and notifications respect user/teacher timezones. - Background Task Processing: Developed backend logic within API routes to fetch necessary data, process it (e.g., filter classes for the next day), and trigger email notifications.
- Serverless Scheduling: Configured and deployed cron jobs using Vercel's infrastructure (
-
Dynamic Document Generation (PDFs) & Client-Side Processing:
- Accomplishment: Enabled users to generate and download/email professional PDF documents for student attendance summaries and financial invoices.
- Skills Demonstrated & Learnings:
- Client-Side PDF Rendering: Employed
@react-pdf/rendererto construct PDF documents using React components, allowing for dynamic data injection and complex layouts directly in the browser. - Blob & Base64 Handling: Managed PDF output as Blobs, converted them to Base64 strings for efficient transmission as email attachments via API calls.
- Client-Side PDF Rendering: Employed
-
Complex UI/UX Implementation & Advanced State Management:
- Accomplishment: Created a feature-rich and intuitive user interface for managing all aspects of a teaching academy, focusing on ease of use and clear information presentation.
- Skills Demonstrated & Learnings:
- Advanced React Patterns: Proficient use of React Hooks (
useState,useEffect,useContext,useRef, custom hooks) for managing complex local and global UI state, side effects, and component lifecycle. - Interactive Components: Developed highly interactive components such as a dynamic attendance calendar, multi-step dialogs for class creation with conditional logic, and sortable/filterable data tables.
- Custom Form Controls: Engineered custom input components like
PhoneInputincorporatinglibphonenumber-jsfor validation and formatting, anduseStateHistoryfor undo/redo functionality in inputs. - UI Libraries & Styling: Leveraged Shadcn/ui and Tailwind CSS to build a consistent, responsive, and accessible design system.
- Animations: Enhanced user experience with subtle and meaningful animations using Framer Motion.
- Advanced React Patterns: Proficient use of React Hooks (
-
Sophisticated Database Schema Design & Data Integrity:
- Accomplishment: Designed a normalized and efficient PostgreSQL database schema within Supabase, capable of handling complex relationships and varied data types while prioritizing data privacy.
- Skills Demonstrated & Learnings:
- Relational Data Modeling: Structured tables to represent entities and their relationships (e.g., many-to-many relationships between students and classes managed via the
student_proxiestable). - JSONB for Flexibility: Utilized PostgreSQL's JSONB data type for fields like
classes_leftandstatusin thestudent_proxiestable, allowing for flexible key-value storage within a relational structure. - Data Integrity & Consistency: Ensured data consistency through appropriate use of foreign keys, unique constraints, and transactional updates where necessary (e.g., updating
classes_leftwhen attendance is marked). - Row Level Security (RLS): Implemented granular RLS policies in Supabase to enforce data access rules, ensuring users can only access data they are authorized to see (detailed further in the "Database Schema & Row Level Security" section).
- Relational Data Modeling: Structured tables to represent entities and their relationships (e.g., many-to-many relationships between students and classes managed via the
-
Resilient API Development & Comprehensive Error Handling:
- Accomplishment: Built a suite of Next.js API routes that are robust, secure, and provide clear feedback for various application operations.
- Skills Demonstrated & Learnings:
- RESTful API Design: Designed API endpoints following REST principles for clarity and predictability.
- Input Validation & Error Handling: Implemented thorough input validation on API routes and comprehensive error handling, returning meaningful HTTP status codes and error messages to the client.
- Asynchronous Operations Management: Proficiently used
async/awaitfor managing asynchronous operations. Developed and used afetchTimeoututility to prevent indefinite hangs when calling external services, improving application stability. - User Feedback Mechanisms: Integrated a toast notification system (
useToast) to provide users with clear feedback on the success or failure of their actions.
Class Access offers a robust set of features to streamline the management of teaching academies:
- π€ User Authentication & Management:
- Secure sign-up and login for teachers and students (email/password).
- Password reset functionality via secure email links.
- Student account activation workflow with email verification.
- Google OAuth 2.0 for teacher login, simplifying access and enabling Google service integrations.
- π« Class & Schedule Management:
- Teachers can create, view, edit, and manage classes with details like name, description, recurring days, and specific start/end times (timezone aware).
- Dynamic generation of meeting links via Google Meet and Zoom API integrations, or marking classes as "In-Person".
- Shareable class enrollment and direct join links for students.
- π Student Administration & Enrollment:
- Teachers can add new students (creating accounts if necessary) or enroll existing students into their classes.
- Streamlined student enrollment process using unique, randomly generated class codes.
- Accurate tracking of each student's remaining paid classes for each course.
- Student "proxy" system allows students to be associated with multiple teachers/classes with distinct attributes (notes, classes left) for each association.
- π Attendance Tracking & Reporting:
- Digital attendance marking (Present/Absent) for students in each class session.
- Support for both individual student attendance views and group/batch attendance marking.
- Interactive calendar interface for viewing and modifying individual student attendance.
- Automated generation and emailing of PDF attendance reports to students/parents.
- π³ Payments & Invoicing System:
- Teachers can create and send detailed invoices to students via email.
- Students can view invoices and make payments using UPI through a generated QR code on a dedicated payment page.
- Teachers can manually record payments received through various methods (Cash, Bank Transfer, etc.).
- Invoice status tracking (Pending, Student Confirmed, Paid) with automated updates.
- PDF invoice generation for record-keeping and sharing.
- βοΈ Automated Communications & Notifications:
- Automated welcome emails for newly registered students with account activation links.
- Automated class enrollment invitation emails to students.
- Daily cron job sends email reminders to teachers about their classes scheduled for the next day.
- π₯οΈ Teacher Dashboard & Analytics:
- Centralized dashboard for teachers to view their scheduled classes, manage student enrollments, and access key functionalities.
- Comprehensive student listing page with details on enrollment status and remaining classes.
- System-level tracking of overall payment volume and number of payments processed.
- π Public-Facing & Informational Pages:
- Engaging landing page showcasing platform features and benefits.
- A "How-To" guide for students detailing the account creation and class enrollment process.
- Dedicated pages for Privacy Policy and Terms of Use.
Class Access utilizes Supabase (PostgreSQL) for its database. The schema is designed to support the application's features efficiently while prioritizing data privacy through Row Level Security (RLS).
Link to Database Schema Diagram
teachers: Stores teacher profiles and configurations.students: Core student profiles (universal student identity,idisauth.uid()).student_proxies: Links students to teachers/classes. This is the primary table teachers interact with regarding student data for their classes. It containsid(unique proxy ID),student_id(FK tostudents.id),teacher_id(FK toteachers.id), and class-specific attributes likeclasses_left(JSONB),status(JSONB),notes,email,first_name,last_name,phone,hasJoined.classes: Defines class details, schedules, and an array ofstudent_proxy_idsfor enrolled students.attendance_records: Logs student attendance, linked viastudent_proxy_id.invoices: Manages financial invoices, linked viastudent_proxy_id.payments: Records all payment transactions, linked viastudent_proxy_id.statistics: Tracks aggregate platform data.google_tokens/zoom_tokens: Securely store encrypted OAuth tokens for teachers, linked viauser_id(which isteachers.id).
Supabase's Row Level Security is integral to Class Access's data protection strategy. Policies are meticulously crafted for each table to ensure users can only access and modify data they are explicitly authorized for.
-
Core RLS Principle: Data access is scoped to the authenticated user's role (
teacherorstudent) and their unique ID (auth.uid()). -
Teacher Data Access: Teachers can generally
SELECT,INSERT,UPDATE,DELETEdata related to their own profile, the classes they own (teacher_id = auth.uid()), and thestudent_proxiesassociated with theirteacher_id. -
Student Data Access: Students can
SELECTandUPDATEtheir own core profile in thestudentstable (auth.uid() = id). They canSELECTstudent_proxieswherestudent_id = auth.uid()to see their enrollments across different teachers/classes. Access to class details, attendance, and invoices is typically granted if theirstudent_proxy_idis associated with the respective records. -
Critical Security & Privacy Design:
student_idvs.student_proxy_id- A fundamental architectural decision for enhancing student privacy and enabling flexible enrollments is the distinction between a student's universal identity (
students.id) and their contextual representation within a specific teacher's domain (student_proxies.id). - Teachers interact primarily with
student_proxy_ids. When a teacher manages their roster, adds a student to a class, or views student-specific information for their courses, they are operating onstudent_proxyrecords. RLS policies onstudent_proxiesare generally scoped such that a teacher can only access proxies whereteacher_id = auth.uid(). - Controlled Visibility of Student Information: This design ensures that a teacher ("Teacher A") does not have automatic access to a student's universal profile in the
studentstable or their interactions with another teacher ("Teacher B"). Teacher A's view is limited to the information pertinent to their relationship with the student, as stored in thestudent_proxyrecord they manage. Personal details like the student's full name and phone number within thestudent_proxiestable are populated only after the student activates their account and consents to share this information in the context of that teacher's class (e.g., via the/api/students/update_proxyendpoint after student activation). - Student Onboarding & Data Control:
- When a teacher invites a student (e.g., by email to a new class), a
student_proxyrecord is created. This proxy might initially contain only the student's email (as provided by the teacher) and a link to the teacher and class. The student's corestudentstable record might not yet exist or might not be fully populated. - The student receives an activation email. Upon clicking the activation link and setting up their password/profile (or logging into an existing core
studentsaccount), their universalstudentsrecord (id,first_name,last_name,phone) is created/updated. - The
student_proxies.hasJoinedflag is set to true, and details likefirst_name,last_name, andphonecan be populated into thestudent_proxiesrecord for that specific teacher's view, based on the student's core profile. This ensures the teacher has the necessary contact information for the students they teach, but only after the student has engaged with the platform.
- When a teacher invites a student (e.g., by email to a new class), a
- Benefits of this Approach:
- Enhanced Student Privacy: A student's activities, notes, or class balance with one teacher are not visible to other teachers they might also be learning from on the platform. Each teacher's view is siloed to their specific
student_proxies. - Facilitates Multi-Teacher/Multi-Class Enrollment: Students can maintain a single, central user account (
studentstable) while enrolling in diverse classes offered by different teachers. Each such enrollment is managed through a distinctstudent_proxyrecord, ensuring clear separation of data and context without data duplication in the core student profile. - Granular Access Control: RLS policies can be more effectively applied, as teacher access is primarily governed by their ownership of
student_proxyrecords rather than direct access to all student data.
- Enhanced Student Privacy: A student's activities, notes, or class balance with one teacher are not visible to other teachers they might also be learning from on the platform. Each teacher's view is siloed to their specific
- A fundamental architectural decision for enhancing student privacy and enabling flexible enrollments is the distinction between a student's universal identity (
-
API Routes & Admin SDK for Privileged Operations:
- For operations requiring broader data access or complex logic that cannot be easily expressed in RLS policies (e.g., initial student account creation triggered by a teacher's invitation, or system-wide administrative tasks), Next.js API routes are utilized.
- These API routes first authenticate the calling user by verifying their JWT. If authorized, these routes can then use the
SUPABASE_SERVICE_KEY(via the Supabase Admin SDK) to perform database operations. This temporarily bypasses RLS with full administrative privileges for that specific, controlled, and audited server-side action. This is essential for tasks like creating a new user in theauth.userstable and then linking them to thestudentsandstudent_proxiestables.
To get a local copy up and running, follow these simple steps.
- Node.js (v18.17.0 or later)
- A package manager: npm, yarn, pnpm, or bun
- A Supabase account and project.
- API keys for Brevo, Google Cloud Platform (for Calendar API), and Zoom Marketplace.
-
Clone the Repository:
git clone https://github.com/sreevikramr/class-access.git cd class-access -
Install Dependencies: Choose your preferred package manager:
npm install # or yarn install # or pnpm install # or bun install
-
Set Up Environment Variables: Create a
.env.localfile in the project root. Populate it with your specific keys and secrets:# Supabase NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_public_anon_key SUPABASE_SERVICE_KEY=your_supabase_service_role_key # For backend operations # Authentication & Security JWT_SECRET=your_strong_and_unique_jwt_secret ENCRYPTION_SECRET=your_very_strong_secret_for_encrypting_tokens_min_32_chars # Email Service (Brevo) EMAIL_TOKEN=your_brevo_api_key # Google OAuth & APIs GOOGLE_CLIENT_ID=your_google_oauth_client_id GOOGLE_CLIENT_SECRET=your_google_oauth_client_secret # Ensure Google Calendar API is enabled for your project in Google Cloud Console. # Set up OAuth consent screen and add `https://classaccess.tech/oauth/google/teacher_login` (or your local equivalent during dev) as an authorized redirect URI. # Zoom OAuth & APIs ZOOM_CLIENT_ID=your_zoom_oauth_app_client_id ZOOM_CLIENT_SECRET=your_zoom_oauth_app_client_secret # Add `https://classaccess.tech/oauth/zoom/callback` (or your local equivalent) as an authorized redirect URI in your Zoom App Marketplace settings. # Cron Job Security (for Vercel cron jobs) CRON_SECRET=your_secret_for_securing_cron_endpoints
Important Security Notes:
- All variables except those prefixed with
NEXT_PUBLIC_are server-side only and must be kept confidential. - The
ENCRYPTION_SECRETis critical for securing stored OAuth tokens. Ensure it's strong and unique.
- All variables except those prefixed with
-
Set up Supabase Database Schema: You will need to set up the tables and relationships in your Supabase project as described in the "Database Schema" section. This can be done via the Supabase Studio UI or by writing SQL migration scripts. Implement Row Level Security policies as outlined.
-
Run the Development Server:
npm run dev # or yarn dev # or pnpm dev # or bun dev
The application will typically be available at http://localhost:3000.
You can begin development by modifying files within the app/ directory. Next.js provides hot module reloading for a seamless development experience.
The simplest way to deploy your Class Access application is using the Vercel Platform, created by the team behind Next.js.
- Ensure your project is pushed to a Git repository (GitHub, GitLab, Bitbucket).
- Sign up or log in to Vercel.
- Import your Git repository.
- Configure your environment variables in the Vercel project settings (as listed in the
.env.localsection). - Configure cron jobs in
vercel.jsonfor scheduled tasks like daily emails. - Deploy!
For detailed deployment instructions, refer to the Next.js deployment documentation.
Sreevikram R - [email protected]
Co-Developer - Meet Gamdha - [email protected]
Project Link: https://github.com/sreevikramr/class-access
