How ammarasad2005/exam-table works
1. Overall shape
This is a Next.js 14 App Router application that behaves like a static, data-driven scheduling portal. The runtime is mostly client-rendered UI over precomputed JSON files, with one small server API for filtered exam data.
2. Primary feature boundaries
The app is split into three main user-facing subsystems: Exam Schedule, Weekly Timetable, and Free Rooms. Two additional workflows support irregular students: Custom Exams and Custom Timetable. Each feature has its own page route and its own filtering/output behavior.
3. Routing and page organization
Feature routes live under src/app/: /schedule, /timetable, /rooms, /custom, /timetable/custom, plus supporting pages like /faculty and /semester. src/app/layout.tsx and shared shell components provide the common navigation/header/theme structure across these pages.
4. Data sources and generated artifacts
The app depends on prebuilt data in public/data/. Exam-related data is generated from exam_schedule.xlsx into a normalized JSON artifact consumed by the schedule feature. Timetable and room data come from a semester schedule source fetched from Google Sheets and are normalized into public/data/timetable.json. Faculty-specific schedule data lives in public/data/faculty/*.json.
5. Exam schedule pipeline
The exam flow is driven by the parsed exam dataset and exposed through /api/schedule, which returns filtered results for the UI. The client pages support filtering by batch, school, department, and text search, then present grouped-by-date results with a detail drawer and export options.
6. Timetable pipeline
The timetable feature reads the generated timetable JSON directly and filters it by batch, department, and section. It supports both a list/detail view and a visual grid view, and includes conflict detection plus a repeat-course toggle. This feature is mostly local computation on top of static timetable data.
7. Free room computation
The room finder is not a separate source of truth; it derives availability from the same timetable dataset. The room-logic layer calculates which rooms are fully vacant or partially vacant for a selected day and slot, and also produces a week-wide availability map.
8. Custom workflows and persistence
The custom exam and custom timetable pages let users build mixed sets from multiple cohorts or course rows. These workflows persist user preferences and reusable bundles in browser storage, so they work without a backend database or account system.
9. Shared domain logic
Most business rules are centralized in src/lib/: date formatting, filtering, export generation, room availability logic, timetable filtering, and shared TypeScript types. This keeps the page components thin and makes the data transformations reusable across exam, timetable, and room views.
10. UI composition layer
src/components/ contains reusable UI pieces such as search, cards, detail drawers, export buttons, navigation, theme toggle, and empty states. These components are combined differently per page, but the underlying data model stays consistent across desktop and mobile layouts.
11. Tooling and build-time automation
scripts/parse-excel.ts is the exam-data ingestion step, and scripts/capture-screenshots.js automates UI screenshots. The repository also includes a GitHub Actions workflow for timetable updates, plus a few auxiliary scripts/tests for schedule generation and validation. These are build/maintenance tools, not part of the runtime app path.
12. Architecture summary for a diagram
The key boundaries are: external source data -> build-time normalization scripts -> static JSON in public/data -> Next.js pages/components -> optional browser storage for custom bundles. The only server-side runtime endpoint is the exam filter API; everything else is driven by precomputed data and client-side filtering/rendering.
Main entry points: lib Domain Logic · timetable.json Timetable Data · layout.tsx Root Layout · page.tsx Schedule Page
Components 20
Build & Data
External sources, normalization scripts, and generated static datasets
- Exam XLSX · Raw exam schedule workbook ingested at build time
exam_schedule.xlsx - Sheet Source · Semester timetable source fetched from Google Sheets
- Parse Excel · Normalizes exam workbook into app-ready data
scripts/parse-excel.ts - Timetable Update · Automates timetable refresh in CI
.github/workflows/update-timetable.yml - Screenshots · Captures UI screenshots for maintenance and publishing
scripts/capture-screenshots.js - Exam Data · Normalized exam schedule consumed by schedule pages and API
public/data - Timetable Data · Generated timetable and faculty JSON used by timetable and room views
public/data/timetable.json - Faculty Data · Faculty-specific schedule bundles
public/data/faculty
App Runtime
Next.js routes, pages, and API surface
- Root Layout · Common app chrome and providers
src/app/layout.tsx - Home Pages · Entry routes that point users into the main portal
src/app/page.tsx - Exam API · Filters exam data for the client schedule views
src/app/api/schedule/route.ts - Schedule Page · Grouped exam schedule with filtering, detail drawer, and export
src/app/schedule/page.tsx - Timetable Page · Batch, department, and section filtered timetable with grid/list views
src/app/timetable/page.tsx - Room Finder · Derives empty and partially free rooms from timetable data
src/app/rooms/page.tsx - Custom Exams · User-built exam sets across cohorts with browser persistence
src/app/custom/page.tsx - Custom Timetable · User-built timetable bundles across course rows with browser persistence
src/app/timetable/custom/page.tsx - Faculty View · Faculty-specific schedule browsing and detail display
src/app/faculty/page.tsx - Semester View · Supporting semester schedule browsing page
src/app/semester/page.tsx
Shared Logic & UI
Reusable business rules and presentation components
- Domain Logic · Dates, filtering, export generation, room logic, and timetable rules
src/lib - UI Components · Search, cards, drawers, navigation, theme, and empty states
src/components
Connections 27
- Exam XLSX → Parse Excel: input · Workbook parsed into normalized exam records
- Sheet Source → Timetable Update: source · Workflow refreshes timetable artifacts from sheet data
- Parse Excel → Exam Data: writes · Build step produces static exam dataset
- Timetable Update → Timetable Data: writes · CI pipeline updates timetable JSON
- Timetable Update → Faculty Data: writes · Refreshes faculty schedule artifacts
- Screenshots → Home Pages: captures · Uses rendered pages for screenshots
- Root Layout → Home Pages: wraps · Shared shell around the app routes
- Root Layout → Schedule Page: wraps · Common layout for schedule flow
- Root Layout → Timetable Page: wraps · Common layout for timetable flow
- Root Layout → Room Finder: wraps · Common layout for room finder
- Exam API → Exam Data: reads · API filters the generated exam dataset
- Schedule Page → Exam API: fetches · Schedule UI requests filtered exam results
- Schedule Page → Domain Logic: uses · Relies on shared filtering, dates, and exports
- Schedule Page → UI Components: composes · Uses cards, search, drawer, and export controls
- Timetable Page → Timetable Data: reads · Timetable UI consumes static timetable JSON
- Timetable Page → Domain Logic: uses · Applies timetable filtering and conflict logic
- Timetable Page → UI Components: composes · Uses timetable cards, detail view, and export UI
- Room Finder → Timetable Data: derives from · Room availability is computed from timetable data
- Room Finder → Domain Logic: uses · Uses room-logic and date helpers
- Custom Exams → Exam Data: reads · Builds custom exam sets from exam data
- Custom Exams → Domain Logic: uses · Shares export and filtering helpers
- Custom Timetable → Timetable Data: reads · Builds custom timetable bundles from timetable data
- Custom Timetable → Domain Logic: uses · Shares timetable filtering and formatting helpers
- Faculty View → Faculty Data: reads · Faculty page consumes faculty-specific JSON
- Faculty View → Domain Logic: uses · Uses shared date and formatting logic
- Semester View → Timetable Data: reads · Semester page is backed by timetable data
- Semester View → UI Components: composes · Uses shared presentation pieces