# nrfalahsa/polaris architecture

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

- Interactive diagram: https://gitdiagram.com/nrfalahsa/polaris
- Repository: https://github.com/nrfalahsa/polaris

## Overview

Polaris is a private, bilingual student LMS. A signed-in student browses semester and course materials, reads and annotates them, and can create or edit content; separate workspace branches manage schedules, tasks, search, progress, and account settings. Server actions authenticate and validate changes before using the database. The README documents capabilities beyond the sampled excerpts, so those branches are represented at their exact route paths; their internal calls are not inferred.

Main entry points: [`lib/actions.ts`](https://github.com/nrfalahsa/polaris/blob/main/lib/actions.ts) (Server actions), [`app/[locale]/dashboard/DashboardClient.tsx`](https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/dashboard/DashboardClient.tsx) (Dashboard), [`components/MateriRenderer.tsx`](https://github.com/nrfalahsa/polaris/blob/main/components/MateriRenderer.tsx) (Material reader), [`auth.ts`](https://github.com/nrfalahsa/polaris/blob/main/auth.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Learning workspace"]
  node_dashboard["Dashboard"]
  node_courses["Course browsing<br/>[MatkulClient.tsx]"]
  node_search["Material search<br/>[SearchClient.tsx]"]
  node_settings["Account settings<br/>[SettingsClient.tsx]"]
  node_locale["Locale routing<br/>[routing.ts]"]
end

subgraph group_content["Materials and reading"]
  node_editor["Material editor<br/>[page.tsx]"]
  node_editmaterial["Edit material"]
  node_reader["Material reader<br/>[MateriRenderer.tsx]"]
  node_sanitize["HTML sanitization<br/>[sanitizeMateri.ts]"]
  node_viewerbridge["Viewer bridge"]
  node_notes["Inline notes<br/>[MateriRenderer.tsx]"]
  node_sandbox["Interactive content sandbox<br/>[route.ts]"]
end

subgraph group_planning["Planning and tracking"]
  node_schedule["Class schedule<br/>[ScheduleClient.tsx]"]
  node_tasks["Task tracking<br/>[TasksClient.tsx]"]
  node_progress["Study progress"]
end

subgraph group_services["Identity and data"]
  node_actions["Server actions<br/>[actions.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_oauth["OAuth providers<br/>[auth.config.ts]"]
  node_database[("Turso database<br/>[index.ts]")]
  node_schema["Data schema<br/>[schema.ts]"]
  node_queries["Data queries<br/>[queries.ts]"]
  node_seed["New-user sample data<br/>[seed.ts]"]
  node_types["Content view models<br/>[content-types.ts]"]
end

node_student(("Student"))

node_student -->|"opens workspace"| node_dashboard
node_dashboard -->|"browses courses"| node_courses
node_student -->|"searches materials"| node_search
node_student -->|"creates material"| node_editor
node_student -->|"manages schedule"| node_schedule
node_student -->|"tracks assignments"| node_tasks
node_student -->|"manages account"| node_settings
node_courses -.->|"opens material"| node_reader
node_reader -->|"sanitizes HTML"| node_sanitize
node_reader -->|"builds bridge script"| node_viewerbridge
node_reader -->|"creates inline notes"| node_notes
node_student -->|"edits material"| node_editmaterial
node_editmaterial -->|"updates material"| node_actions
node_schedule -->|"creates schedule"| node_actions
node_tasks -->|"creates and updates tasks"| node_actions
node_settings -->|"updates account"| node_actions
node_actions -->|"checks identity"| node_auth
node_auth -->|"uses configuration"| node_oauth
node_auth -->|"configures adapter"| node_database
node_auth -->|"seeds new users"| node_seed
node_database -->|"uses schema"| node_schema
node_actions -.->|"persists changes"| node_database
node_queries -.->|"reads data"| node_database
node_dashboard -->|"renders progress"| node_progress
node_search -->|"uses material metadata"| node_types
node_dashboard -->|"uses content models"| node_types
node_student -->|"runs interactive content"| node_sandbox
node_student -->|"selects language"| node_locale

click node_dashboard "https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/dashboard/DashboardClient.tsx"
click node_courses "https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/%5Bsemester%5D/%5Bmatkul%5D/MatkulClient.tsx"
click node_search "https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/search/SearchClient.tsx"
click node_editor "https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/editor/page.tsx"
click node_editmaterial "https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/editor/edit/%5Bid%5D/EditMaterialClient.tsx"
click node_reader "https://github.com/nrfalahsa/polaris/blob/main/components/MateriRenderer.tsx"
click node_sanitize "https://github.com/nrfalahsa/polaris/blob/main/lib/sanitizeMateri.ts"
click node_viewerbridge "https://github.com/nrfalahsa/polaris/blob/main/lib/materiViewerBridge.ts"
click node_notes "https://github.com/nrfalahsa/polaris/blob/main/components/MateriRenderer.tsx"
click node_schedule "https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/schedule/ScheduleClient.tsx"
click node_tasks "https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/tasks/TasksClient.tsx"
click node_progress "https://github.com/nrfalahsa/polaris/blob/main/components/ProgressWrapper.tsx"
click node_settings "https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/settings/SettingsClient.tsx"
click node_actions "https://github.com/nrfalahsa/polaris/blob/main/lib/actions.ts"
click node_auth "https://github.com/nrfalahsa/polaris/blob/main/auth.ts"
click node_oauth "https://github.com/nrfalahsa/polaris/blob/main/auth.config.ts"
click node_database "https://github.com/nrfalahsa/polaris/blob/main/lib/db/index.ts"
click node_schema "https://github.com/nrfalahsa/polaris/blob/main/lib/db/schema.ts"
click node_queries "https://github.com/nrfalahsa/polaris/blob/main/lib/db/queries.ts"
click node_seed "https://github.com/nrfalahsa/polaris/blob/main/lib/db/seed.ts"
click node_types "https://github.com/nrfalahsa/polaris/blob/main/lib/content-types.ts"
click node_sandbox "https://github.com/nrfalahsa/polaris/blob/main/app/api/sandbox/route.ts"
click node_locale "https://github.com/nrfalahsa/polaris/blob/main/i18n/routing.ts"

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_dashboard,node_courses,node_search,node_settings,node_locale toneBlue
class node_editor,node_editmaterial,node_reader,node_sanitize,node_viewerbridge,node_notes,node_sandbox toneAmber
class node_schedule,node_tasks,node_progress toneMint
class node_actions,node_auth,node_oauth,node_database,node_schema,node_queries,node_seed,node_types toneRose
class node_student toneIndigo
```

## Components

### Learning workspace

- [Dashboard](https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/dashboard/DashboardClient.tsx): `app/[locale]/dashboard/DashboardClient.tsx`
- [Course browsing](https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/%5Bsemester%5D/%5Bmatkul%5D/MatkulClient.tsx): `app/[locale]/[semester]/[matkul]/MatkulClient.tsx`
- [Material search](https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/search/SearchClient.tsx): `app/[locale]/search/SearchClient.tsx`
- [Account settings](https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/settings/SettingsClient.tsx): `app/[locale]/settings/SettingsClient.tsx`
- [Locale routing](https://github.com/nrfalahsa/polaris/blob/main/i18n/routing.ts): `i18n/routing.ts`

### Materials and reading

- [Material editor](https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/editor/page.tsx): `app/[locale]/editor/page.tsx`
- [Edit material](https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/editor/edit/%5Bid%5D/EditMaterialClient.tsx): `app/[locale]/editor/edit/[id]/EditMaterialClient.tsx`
- [Material reader](https://github.com/nrfalahsa/polaris/blob/main/components/MateriRenderer.tsx): `components/MateriRenderer.tsx`
- [HTML sanitization](https://github.com/nrfalahsa/polaris/blob/main/lib/sanitizeMateri.ts): `lib/sanitizeMateri.ts`
- [Viewer bridge](https://github.com/nrfalahsa/polaris/blob/main/lib/materiViewerBridge.ts): `lib/materiViewerBridge.ts`
- [Inline notes](https://github.com/nrfalahsa/polaris/blob/main/components/MateriRenderer.tsx): `components/MateriRenderer.tsx`
- [Interactive content sandbox](https://github.com/nrfalahsa/polaris/blob/main/app/api/sandbox/route.ts): `app/api/sandbox/route.ts`

### Planning and tracking

- [Class schedule](https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/schedule/ScheduleClient.tsx): `app/[locale]/schedule/ScheduleClient.tsx`
- [Task tracking](https://github.com/nrfalahsa/polaris/blob/main/app/%5Blocale%5D/tasks/TasksClient.tsx): `app/[locale]/tasks/TasksClient.tsx`
- [Study progress](https://github.com/nrfalahsa/polaris/blob/main/components/ProgressWrapper.tsx): `components/ProgressWrapper.tsx`

### Identity and data

- [Server actions](https://github.com/nrfalahsa/polaris/blob/main/lib/actions.ts): `lib/actions.ts`
- [Authentication](https://github.com/nrfalahsa/polaris/blob/main/auth.ts): `auth.ts`
- [OAuth providers](https://github.com/nrfalahsa/polaris/blob/main/auth.config.ts): `auth.config.ts`
- [Turso database](https://github.com/nrfalahsa/polaris/blob/main/lib/db/index.ts): `lib/db/index.ts`
- [Data schema](https://github.com/nrfalahsa/polaris/blob/main/lib/db/schema.ts): `lib/db/schema.ts`
- [Data queries](https://github.com/nrfalahsa/polaris/blob/main/lib/db/queries.ts): `lib/db/queries.ts`
- [New-user sample data](https://github.com/nrfalahsa/polaris/blob/main/lib/db/seed.ts): `lib/db/seed.ts`
- [Content view models](https://github.com/nrfalahsa/polaris/blob/main/lib/content-types.ts): `lib/content-types.ts`

### Other components

- **Student**

## Connections

- Student → Dashboard: opens workspace (evidence: `README.md`)
- Dashboard → Course browsing: browses courses (evidence: `app/[locale]/dashboard/DashboardClient.tsx`)
- Student → Material search: searches materials (evidence: `README.md`)
- Student → Material editor: creates material (evidence: `README.md`)
- Student → Class schedule: manages schedule (evidence: `README.md`)
- Student → Task tracking: tracks assignments (evidence: `README.md`)
- Student → Account settings: manages account (evidence: `README.md`)
- Course browsing → Material reader: opens material
- Material reader → HTML sanitization: sanitizes HTML (evidence: `components/MateriRenderer.tsx`)
- Material reader → Viewer bridge: builds bridge script (evidence: `components/MateriRenderer.tsx`)
- Material reader → Inline notes: creates inline notes (evidence: `components/MateriRenderer.tsx`)
- Student → Edit material: edits material (evidence: `README.md`)
- Edit material → Server actions: updates material (evidence: `app/[locale]/editor/edit/[id]/EditMaterialClient.tsx`)
- Class schedule → Server actions: creates schedule (evidence: `app/[locale]/schedule/ScheduleClient.tsx`)
- Task tracking → Server actions: creates and updates tasks (evidence: `app/[locale]/tasks/TasksClient.tsx`)
- Account settings → Server actions: updates account (evidence: `app/[locale]/settings/SettingsClient.tsx`)
- Server actions → Authentication: checks identity (evidence: `lib/actions.ts`)
- Authentication → OAuth providers: uses configuration (evidence: `auth.ts`)
- Authentication → Turso database: configures adapter (evidence: `auth.ts`)
- Authentication → New-user sample data: seeds new users (evidence: `auth.ts`)
- Turso database → Data schema: uses schema (evidence: `lib/db/index.ts`)
- Server actions → Turso database: persists changes (evidence: `lib/actions.ts`)
- Data queries → Turso database: reads data
- Dashboard → Study progress: renders progress (evidence: `app/[locale]/dashboard/DashboardClient.tsx`)
- Material search → Content view models: uses material metadata (evidence: `app/[locale]/search/SearchClient.tsx`)
- Dashboard → Content view models: uses content models (evidence: `app/[locale]/dashboard/DashboardClient.tsx`)
- Student → Interactive content sandbox: runs interactive content (evidence: `README.md`)
- Student → Locale routing: selects language (evidence: `README.md`)
