# errnolink/cadence-planner architecture

> Architecture diagram of the GitHub repository errnolink/cadence-planner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/errnolink/cadence-planner
- Repository: https://github.com/errnolink/cadence-planner

## Overview

#### Purpose and Runtime
Cadence Planner is a client-side academic planner for organizing semesters, subjects, weekly timetables, calendar events, and attendance. It runs as a React 19 single-page application built and served by Vite, with Tailwind and CSS-variable theme styling. The browser client integrates with Supabase for authentication and persisted planner data.

Entry points:
- `src/main.jsx` mounts the React application.
- `src/App.jsx` composes the application shell and feature views.
- `src/data/supabaseClient.js` establishes the Supabase client boundary.

#### Application Composition and Navigation
`App.jsx` is the primary orchestration layer: it connects state hooks, authenticated data, selected-semester context, and the visible planner view. Layout controls provide desktop and mobile navigation plus global settings:
- `src/App.jsx`
- `src/components/layout/ControlBar.jsx`
- `src/components/layout/MobileTabBar.jsx`

Shared modal and dropdown primitives isolate interaction mechanics from domain-specific views:
- `src/components/ui/Modal.jsx`
- `src/components/ui/Dropdown.jsx`
- `src/components/layout/SettingsModal.jsx`

#### Identity, Persistence, and Sync Boundary
Authentication is handled in the UI and exposed through a dedicated React hook. Supabase-related client/API modules form the remote persistence boundary; feature components should consume domain hooks/API abstractions rather than directly own backend concerns.
- `src/components/Auth.jsx`
- `src/hooks/useAuth.jsx`
- `src/data/api.js`
- `src/data/supabaseClient.js`

`SyncChip` likely surfaces synchronization state to users, while initial data and constants support startup/default state:
- `src/components/ui/SyncChip.jsx`
- `src/data/initialData.js`
- `src/data/constants.js`

#### Semester and Subject Domain Flow
Semester selection drives the active working set. The semester hook manages semester-level state, and the roster renders/edit subjects within that selected term. Subject rows and GPA display are subordinate projections of subject metadata such as credits and grades.
- `src/hooks/useSemesters.js`
- `src/components/layout/SemDropdown.jsx`
- `src/components/roster/SubjectRoster.jsx`
- `src/components/roster/SubjectRow.jsx`
- `src/components/roster/GpaBadge.jsx`

Primary flow: authenticated user → semesters → active semester → subject roster → timetable/attendance/calendar records associated with subjects.

#### Timetable and Calendar Scheduling
The timetable is the weekly schedule authoring and visualization surface. A grid displays class instances, while modals provide creation/detail editing boundaries. Calendar provides date-oriented visibility and daily drill-down.
- `src/components/timetable/TimetableGrid.jsx`
- `src/components/timetable/ClassInstanceModal.jsx`
- `src/components/timetable/TimetableModal.jsx`
- `src/components/calendar/CalendarView.jsx`
- `src/components/calendar/DayDetailModal.jsx`

Scheduling data must bridge recurring/weekly timetable structure with dated calendar and attendance views without leaking UI modal state into persisted domain records.

#### Attendance Tracking
Attendance is a separate domain state layer, likely keyed by subject and date/class occurrence. Its hook centralizes attendance operations; the view exposes summaries while the subject modal supports detailed records.
- `src/hooks/useAttendance.js`
- `src/components/attendance/AttendanceView.jsx`
- `src/components/attendance/SubjectAttendanceModal.jsx`

Attendance depends on the active semester and subjects, and may use timetable/calendar events as the context for marking or reviewing classes.

#### Themes, Resilience, and Deployment Instrumentation
Theme context selects and applies visual systems, including the “nerv” and “minimal” theme packages. Error isolation prevents a feature failure from taking down the SPA. Vercel Analytics is a deployment-time external telemetry integration.
- `src/themes/ThemeContext.jsx`
- `src/themes/nerv/styles.css`
- `src/themes/minimal/styles.css`
- `src/components/ErrorBoundary.jsx`
- `src/VercelAnalytics.jsx`

Main entry points: [`src/App.jsx`](https://github.com/errnolink/cadence-planner/blob/main/src/App.jsx) (App orchestrator), [`src/hooks/useSemesters.js`](https://github.com/errnolink/cadence-planner/blob/main/src/hooks/useSemesters.js) (Semester state), [`src/hooks/useAttendance.js`](https://github.com/errnolink/cadence-planner/blob/main/src/hooks/useAttendance.js) (Attendance state), [`src/components/timetable/TimetableGrid.jsx`](https://github.com/errnolink/cadence-planner/blob/main/src/components/timetable/TimetableGrid.jsx) (Weekly timetable)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React SPA"]
  node_main["Application entry<br/>React entry<br/>[main.jsx]"]
  node_app["App orchestrator<br/>application shell<br/>[App.jsx]"]
  node_auth["Authentication UI<br/>identity view<br/>[Auth.jsx]"]
  node_use_auth["Auth hook<br/>state hook<br/>[useAuth.jsx]"]
  node_navigation["Desktop and mobile navigation<br/>layout controls<br/>[ControlBar.jsx]"]
  node_settings["Settings modal<br/>global settings<br/>[SettingsModal.jsx]"]
  node_resilience["Error boundary<br/>failure isolation<br/>[ErrorBoundary.jsx]"]
end

subgraph group_domains["Planner domains"]
  node_semesters{{"Semester state<br/>domain hook<br/>[useSemesters.js]"}}
  node_semester_picker["Semester picker<br/>semester control<br/>[SemDropdown.jsx]"]
  node_roster["Subject roster<br/>subject view<br/>[SubjectRoster.jsx]"]
  node_timetable["Weekly timetable<br/>schedule view<br/>[TimetableGrid.jsx]"]
  node_class_editor["Class editors<br/>schedule modals"]
  node_calendar["Calendar<br/>dated schedule view<br/>[CalendarView.jsx]"]
  node_day_detail["Day detail<br/>calendar modal<br/>[DayDetailModal.jsx]"]
  node_attendance{{"Attendance state<br/>domain hook<br/>[useAttendance.js]"}}
  node_attendance_view["Attendance view<br/>attendance UI<br/>[AttendanceView.jsx]"]
  node_attendance_detail["Subject attendance detail<br/>attendance modal"]
end

subgraph group_platform["Platform services"]
  node_api{{"Planner API<br/>data abstraction<br/>[api.js]"}}
  node_supabase[("Supabase client<br/>remote backend client<br/>[supabaseClient.js]")]
  node_theme["Theme context<br/>visual system<br/>[ThemeContext.jsx]"]
  node_analytics["Vercel Analytics<br/>telemetry integration"]
end

node_main -->|"mounts"| node_app
node_app -->|"isolates UI"| node_resilience
node_app -->|"renders signed-out flow"| node_auth
node_auth -->|"uses"| node_use_auth
node_use_auth -->|"authenticates with"| node_supabase
node_app -->|"composes"| node_navigation
node_app -->|"opens"| node_settings
node_app -->|"uses"| node_semesters
node_semester_picker -->|"selects"| node_semesters
node_semesters -->|"loads and persists"| node_api
node_semesters -->|"provides active term"| node_roster
node_roster -->|"subjects schedule classes"| node_timetable
node_semesters -->|"scopes"| node_timetable
node_timetable -->|"edits through"| node_class_editor
node_timetable -->|"bridges recurring schedule"| node_calendar
node_calendar -->|"drills into"| node_day_detail
node_semesters -->|"scopes"| node_attendance
node_roster -->|"supplies subjects"| node_attendance
node_timetable -.->|"supplies class context"| node_attendance
node_calendar -.->|"supplies dated context"| node_attendance
node_attendance -->|"drives"| node_attendance_view
node_attendance_view -->|"opens"| node_attendance_detail
node_attendance -->|"persists through"| node_api
node_api -->|"uses"| node_supabase
node_app -->|"applies"| node_theme
node_app -.->|"reports usage"| node_analytics

click node_main "https://github.com/errnolink/cadence-planner/blob/main/src/main.jsx"
click node_app "https://github.com/errnolink/cadence-planner/blob/main/src/App.jsx"
click node_auth "https://github.com/errnolink/cadence-planner/blob/main/src/components/Auth.jsx"
click node_use_auth "https://github.com/errnolink/cadence-planner/blob/main/src/hooks/useAuth.jsx"
click node_navigation "https://github.com/errnolink/cadence-planner/blob/main/src/components/layout/ControlBar.jsx"
click node_settings "https://github.com/errnolink/cadence-planner/blob/main/src/components/layout/SettingsModal.jsx"
click node_semesters "https://github.com/errnolink/cadence-planner/blob/main/src/hooks/useSemesters.js"
click node_semester_picker "https://github.com/errnolink/cadence-planner/blob/main/src/components/layout/SemDropdown.jsx"
click node_roster "https://github.com/errnolink/cadence-planner/blob/main/src/components/roster/SubjectRoster.jsx"
click node_timetable "https://github.com/errnolink/cadence-planner/blob/main/src/components/timetable/TimetableGrid.jsx"
click node_class_editor "https://github.com/errnolink/cadence-planner/blob/main/src/components/timetable/ClassInstanceModal.jsx"
click node_calendar "https://github.com/errnolink/cadence-planner/blob/main/src/components/calendar/CalendarView.jsx"
click node_day_detail "https://github.com/errnolink/cadence-planner/blob/main/src/components/calendar/DayDetailModal.jsx"
click node_attendance "https://github.com/errnolink/cadence-planner/blob/main/src/hooks/useAttendance.js"
click node_attendance_view "https://github.com/errnolink/cadence-planner/blob/main/src/components/attendance/AttendanceView.jsx"
click node_attendance_detail "https://github.com/errnolink/cadence-planner/blob/main/src/components/attendance/SubjectAttendanceModal.jsx"
click node_api "https://github.com/errnolink/cadence-planner/blob/main/src/data/api.js"
click node_supabase "https://github.com/errnolink/cadence-planner/blob/main/src/data/supabaseClient.js"
click node_theme "https://github.com/errnolink/cadence-planner/blob/main/src/themes/ThemeContext.jsx"
click node_resilience "https://github.com/errnolink/cadence-planner/blob/main/src/components/ErrorBoundary.jsx"
click node_analytics "https://github.com/errnolink/cadence-planner/blob/main/src/VercelAnalytics.jsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_app,node_auth,node_use_auth,node_navigation,node_settings,node_resilience toneBlue
class node_semesters,node_semester_picker,node_roster,node_timetable,node_class_editor,node_calendar,node_day_detail,node_attendance,node_attendance_view,node_attendance_detail toneAmber
class node_api,node_supabase,node_theme,node_analytics toneMint
```

## Components

### React SPA

Client-side planner application.

- [Application entry](https://github.com/errnolink/cadence-planner/blob/main/src/main.jsx): React entry · `src/main.jsx`
- [App orchestrator](https://github.com/errnolink/cadence-planner/blob/main/src/App.jsx): application shell · Connects authentication, active data, navigation, and visible views. · `src/App.jsx`
- [Authentication UI](https://github.com/errnolink/cadence-planner/blob/main/src/components/Auth.jsx): identity view · `src/components/Auth.jsx`
- [Auth hook](https://github.com/errnolink/cadence-planner/blob/main/src/hooks/useAuth.jsx): state hook · `src/hooks/useAuth.jsx`
- [Desktop and mobile navigation](https://github.com/errnolink/cadence-planner/blob/main/src/components/layout/ControlBar.jsx): layout controls · `src/components/layout/ControlBar.jsx`
- [Settings modal](https://github.com/errnolink/cadence-planner/blob/main/src/components/layout/SettingsModal.jsx): global settings · `src/components/layout/SettingsModal.jsx`
- [Error boundary](https://github.com/errnolink/cadence-planner/blob/main/src/components/ErrorBoundary.jsx): failure isolation · Prevents feature failures from taking down the SPA. · `src/components/ErrorBoundary.jsx`

### Planner domains

Semester-scoped planning features.

- [Semester state](https://github.com/errnolink/cadence-planner/blob/main/src/hooks/useSemesters.js): domain hook · Selects the active semester and its working set. · `src/hooks/useSemesters.js`
- [Semester picker](https://github.com/errnolink/cadence-planner/blob/main/src/components/layout/SemDropdown.jsx): semester control · `src/components/layout/SemDropdown.jsx`
- [Subject roster](https://github.com/errnolink/cadence-planner/blob/main/src/components/roster/SubjectRoster.jsx): subject view · Renders and edits subjects for the active term. · `src/components/roster/SubjectRoster.jsx`
- [Weekly timetable](https://github.com/errnolink/cadence-planner/blob/main/src/components/timetable/TimetableGrid.jsx): schedule view · Authors and visualizes recurring class instances. · `src/components/timetable/TimetableGrid.jsx`
- [Class editors](https://github.com/errnolink/cadence-planner/blob/main/src/components/timetable/ClassInstanceModal.jsx): schedule modals · Creation and detail editing boundary for timetable classes. · `src/components/timetable/ClassInstanceModal.jsx`
- [Calendar](https://github.com/errnolink/cadence-planner/blob/main/src/components/calendar/CalendarView.jsx): dated schedule view · Provides date-oriented schedule visibility and drill-down. · `src/components/calendar/CalendarView.jsx`
- [Day detail](https://github.com/errnolink/cadence-planner/blob/main/src/components/calendar/DayDetailModal.jsx): calendar modal · `src/components/calendar/DayDetailModal.jsx`
- [Attendance state](https://github.com/errnolink/cadence-planner/blob/main/src/hooks/useAttendance.js): domain hook · Centralizes attendance operations by subject and occurrence. · `src/hooks/useAttendance.js`
- [Attendance view](https://github.com/errnolink/cadence-planner/blob/main/src/components/attendance/AttendanceView.jsx): attendance UI · `src/components/attendance/AttendanceView.jsx`
- [Subject attendance detail](https://github.com/errnolink/cadence-planner/blob/main/src/components/attendance/SubjectAttendanceModal.jsx): attendance modal · `src/components/attendance/SubjectAttendanceModal.jsx`

### Platform services

Remote persistence, styling, and telemetry boundaries.

- [Planner API](https://github.com/errnolink/cadence-planner/blob/main/src/data/api.js): data abstraction · Domain-facing persistence boundary for planner data. · `src/data/api.js`
- [Supabase client](https://github.com/errnolink/cadence-planner/blob/main/src/data/supabaseClient.js): remote backend client · Authentication and persisted planner-data integration. · `src/data/supabaseClient.js`
- [Theme context](https://github.com/errnolink/cadence-planner/blob/main/src/themes/ThemeContext.jsx): visual system · Applies selectable CSS-variable themes. · `src/themes/ThemeContext.jsx`
- [Vercel Analytics](https://github.com/errnolink/cadence-planner/blob/main/src/VercelAnalytics.jsx): telemetry integration · `src/VercelAnalytics.jsx`

## Connections

- Application entry → App orchestrator: mounts
- App orchestrator → Error boundary: isolates UI
- App orchestrator → Authentication UI: renders signed-out flow
- Authentication UI → Auth hook: uses
- Auth hook → Supabase client: authenticates with
- App orchestrator → Desktop and mobile navigation: composes
- App orchestrator → Settings modal: opens
- App orchestrator → Semester state: uses
- Semester picker → Semester state: selects
- Semester state → Planner API: loads and persists
- Semester state → Subject roster: provides active term
- Subject roster → Weekly timetable: subjects schedule classes
- Semester state → Weekly timetable: scopes
- Weekly timetable → Class editors: edits through
- Weekly timetable → Calendar: bridges recurring schedule
- Calendar → Day detail: drills into
- Semester state → Attendance state: scopes
- Subject roster → Attendance state: supplies subjects
- Weekly timetable → Attendance state: supplies class context
- Calendar → Attendance state: supplies dated context
- Attendance state → Attendance view: drives
- Attendance view → Subject attendance detail: opens
- Attendance state → Planner API: persists through
- Planner API → Supabase client: uses
- App orchestrator → Theme context: applies
- App orchestrator → Vercel Analytics: reports usage
