How bakedpotato52/class_scheduler works
Project Type and Purpose
• Class Scheduler is a full-stack web application built with Next.js (“app” directory, page.tsx files, API routes under app/api).
• Purpose: Enable educational institutions to manage class schedules, room assignments, teacher allocations, conflict detection, calendar exports, and reporting.
File Structure Analysis
• Top-level “app” directory follows Next.js 13’s App Router model.
• app/layout.tsx & app/page.tsx – root layout and home page.
• app/(dashboard) – nested layouts for Dashboard; further subdivided into admin, teacher, and student sections, each with its own layout.tsx and page.tsx.
• app/api/delete/route.ts – serverless endpoint for schedule deletion.
• app/auth – login/register pages, each with layout and page.
• “components” directory contains reusable UI components and providers (auth-provider, notification-provider, theme-provider).
• “hooks” for React hooks (use-auth, use-toast, use-mobile).
• “lib” for utility modules and service connectors (Firebase, Cloudinary, notifications, utils).
• Config and deployment files: next.config.mjs, tailwind.config.ts, postcss.config.mjs, tsconfig.json.
• Public assets: PWA manifest.json, Firebase messaging service worker, static files.
README & Tech Stack Insights
• Next.js + React for frontend & serverless functions.
• Firebase (Auth, Firestore/Realtime DB, Messaging) for authentication, data storage, and push notifications.
• Cloudinary for image uploads (via lib/cloudinary.ts).
• Tailwind CSS for styling and UI.
• PWA support via public/manifest.json and firebase-messaging-sw.js.
Main Components and Their Interactions
a. Frontend/UI Layer
• Next.js pages/components render the dashboard, auth pages, and shared UI (buttons, tables, modals).
• Providers (AuthProvider, NotificationProvider, ThemeProvider) wrap the app for global state and context.
b. Server/API Layer
• Next.js Serverless Functions (app/api routes) expose endpoints (e.g., DELETE /api/delete).
• Business logic libraries (lib/utils, lib/notifications) invoked by both client and server routes.
c. Data & External Services
• Firebase
– Authentication (signup, login)
– Database (schedules, rooms, users, notifications)
– Messaging (push notifications via service worker)
• Cloudinary
– Asset uploads for profile pictures etc.
• Calendar Integration
– Export logic likely handled in lib/utils or server functions.
Architectural Patterns & Principles
• Layered architecture: UI → API → Business logic → Data/External services.
• Separation of concerns:
• Next.js App Router organizes pages/layouts per user role (admin, teacher, student).
• “components”, “hooks”, and “lib” isolate UI, reusable logic, and service connectors.
• Context Providers for cross-cutting concerns (auth, notifications, theme).
• Utility-first styling with Tailwind.