# ljcalica071-cmd/class_realm01 architecture

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

- Interactive diagram: https://gitdiagram.com/ljcalica071-cmd/class_realm01
- Repository: https://github.com/ljcalica071-cmd/class_realm01

## Overview

ClassRealm is identified as an integrated SHS management system, but the tree contains no Flutter/Dart application source, so its end-user interface and complete workflow cannot be traced. The visible runtime consists of Flutter platform shells and Supabase edge functions for student provisioning, first-login OTP, and other account operations. The sampled functions show Firebase identity checks, Supabase data operations, and email delivery. Dashed entry links indicate HTTP initiation; unsampled function internals are not inferred.

Main entry points: [`supabase/functions/_shared/firebase_admin.ts`](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/_shared/firebase_admin.ts) (Firebase auth helper), [`supabase/functions/provision-student/index.ts`](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/provision-student/index.ts) (Provision student), [`supabase/functions/first-login-otp/index.ts`](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/first-login-otp/index.ts) (First-login OTP), [`windows/runner/flutter_window.cpp`](https://github.com/ljcalica071-cmd/class_realm01/blob/main/windows/runner/flutter_window.cpp) (Windows shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shells["Flutter platform shells"]
  node_linux_shell["Linux shell<br/>[my_application.cc]"]
  node_linux_plugins["Linux plugins"]
  node_windows_shell["Windows shell<br/>[flutter_window.cpp]"]
  node_windows_window["Windows window<br/>[win32_window.cpp]"]
  node_windows_plugins["Windows plugins"]
  node_macos_plugins["macOS plugins"]
  node_android_shell["Android shell<br/>[MainActivity.kt]"]
  node_ios_shell["iOS shell<br/>[AppDelegate.swift]"]
end

subgraph group_accounts["Account workflows"]
  node_provision_student["Provision student<br/>[index.ts]"]
  node_first_otp["First-login OTP<br/>[index.ts]"]
  node_approve_teacher["Approve teacher<br/>[index.ts]"]
  node_complete_login["Complete first login<br/>[index.ts]"]
  node_delete_user["Delete Firebase user<br/>[index.ts]"]
  node_student_dashboard["Student dashboard<br/>[index.ts]"]
  node_update_student["Update student<br/>[index.ts]"]
  node_send_email["Send email<br/>[index.ts]"]
end

subgraph group_services["Identity and services"]
  node_firebase_helper["Firebase auth helper<br/>[firebase_admin.ts]"]
  node_supabase_db[("Supabase database")]
  node_firebase_identity["Firebase Identity Toolkit"]
  node_smtp["SMTP mail service"]
end

node_http_actor(("HTTP clients"))

node_http_actor -.->|"posts request"| node_provision_student
node_http_actor -.->|"posts request"| node_first_otp
node_provision_student -->|"authenticates caller"| node_firebase_helper
node_first_otp -->|"authenticates caller"| node_firebase_helper
node_approve_teacher -->|"uses auth helper"| node_firebase_helper
node_complete_login -->|"uses auth helper"| node_firebase_helper
node_delete_user -->|"uses auth helper"| node_firebase_helper
node_student_dashboard -->|"uses auth helper"| node_firebase_helper
node_update_student -->|"uses auth helper"| node_firebase_helper
node_provision_student -->|"reads and writes"| node_supabase_db
node_provision_student -->|"creates account"| node_firebase_identity
node_provision_student -->|"sends credentials"| node_smtp
node_first_otp -->|"reads and verifies OTP"| node_supabase_db
node_first_otp -->|"sends code"| node_smtp
node_firebase_helper -->|"validates token"| node_firebase_identity
node_linux_shell -.->|"registers plugins"| node_linux_plugins
node_windows_shell -->|"uses window"| node_windows_window
node_windows_shell -.->|"registers plugins"| node_windows_plugins

click node_linux_shell "https://github.com/ljcalica071-cmd/class_realm01/blob/main/linux/runner/my_application.cc"
click node_linux_plugins "https://github.com/ljcalica071-cmd/class_realm01/blob/main/linux/flutter/generated_plugin_registrant.cc"
click node_windows_shell "https://github.com/ljcalica071-cmd/class_realm01/blob/main/windows/runner/flutter_window.cpp"
click node_windows_window "https://github.com/ljcalica071-cmd/class_realm01/blob/main/windows/runner/win32_window.cpp"
click node_windows_plugins "https://github.com/ljcalica071-cmd/class_realm01/blob/main/windows/flutter/generated_plugin_registrant.cc"
click node_macos_plugins "https://github.com/ljcalica071-cmd/class_realm01/blob/main/macos/Flutter/GeneratedPluginRegistrant.swift"
click node_android_shell "https://github.com/ljcalica071-cmd/class_realm01/blob/main/android/app/src/main/kotlin/com/classrealm/class_realm/MainActivity.kt"
click node_ios_shell "https://github.com/ljcalica071-cmd/class_realm01/blob/main/ios/Runner/AppDelegate.swift"
click node_provision_student "https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/provision-student/index.ts"
click node_first_otp "https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/first-login-otp/index.ts"
click node_approve_teacher "https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/approve-teacher/index.ts"
click node_complete_login "https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/complete-first-login/index.ts"
click node_delete_user "https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/delete-firebase-user/index.ts"
click node_student_dashboard "https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/student-dashboard/index.ts"
click node_update_student "https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/update-student/index.ts"
click node_send_email "https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/send-email/index.ts"
click node_firebase_helper "https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/_shared/firebase_admin.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_linux_shell,node_linux_plugins,node_windows_shell,node_windows_window,node_windows_plugins,node_macos_plugins,node_android_shell,node_ios_shell,node_http_actor toneBlue
class node_provision_student,node_first_otp,node_approve_teacher,node_complete_login,node_delete_user,node_student_dashboard,node_update_student,node_send_email toneAmber
class node_firebase_helper,node_supabase_db,node_firebase_identity,node_smtp toneMint
```

## Components

### Flutter platform shells

- [Linux shell](https://github.com/ljcalica071-cmd/class_realm01/blob/main/linux/runner/my_application.cc): `linux/runner/my_application.cc`
- [Linux plugins](https://github.com/ljcalica071-cmd/class_realm01/blob/main/linux/flutter/generated_plugin_registrant.cc): `linux/flutter/generated_plugin_registrant.cc`
- [Windows shell](https://github.com/ljcalica071-cmd/class_realm01/blob/main/windows/runner/flutter_window.cpp): `windows/runner/flutter_window.cpp`
- [Windows window](https://github.com/ljcalica071-cmd/class_realm01/blob/main/windows/runner/win32_window.cpp): `windows/runner/win32_window.cpp`
- [Windows plugins](https://github.com/ljcalica071-cmd/class_realm01/blob/main/windows/flutter/generated_plugin_registrant.cc): `windows/flutter/generated_plugin_registrant.cc`
- [macOS plugins](https://github.com/ljcalica071-cmd/class_realm01/blob/main/macos/Flutter/GeneratedPluginRegistrant.swift): `macos/Flutter/GeneratedPluginRegistrant.swift`
- [Android shell](https://github.com/ljcalica071-cmd/class_realm01/blob/main/android/app/src/main/kotlin/com/classrealm/class_realm/MainActivity.kt): `android/app/src/main/kotlin/com/classrealm/class_realm/MainActivity.kt`
- [iOS shell](https://github.com/ljcalica071-cmd/class_realm01/blob/main/ios/Runner/AppDelegate.swift): `ios/Runner/AppDelegate.swift`

### Account workflows

- [Provision student](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/provision-student/index.ts): `supabase/functions/provision-student/index.ts`
- [First-login OTP](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/first-login-otp/index.ts): `supabase/functions/first-login-otp/index.ts`
- [Approve teacher](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/approve-teacher/index.ts): `supabase/functions/approve-teacher/index.ts`
- [Complete first login](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/complete-first-login/index.ts): `supabase/functions/complete-first-login/index.ts`
- [Delete Firebase user](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/delete-firebase-user/index.ts): `supabase/functions/delete-firebase-user/index.ts`
- [Student dashboard](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/student-dashboard/index.ts): `supabase/functions/student-dashboard/index.ts`
- [Update student](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/update-student/index.ts): `supabase/functions/update-student/index.ts`
- [Send email](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/send-email/index.ts): `supabase/functions/send-email/index.ts`

### Identity and services

- [Firebase auth helper](https://github.com/ljcalica071-cmd/class_realm01/blob/main/supabase/functions/_shared/firebase_admin.ts): `supabase/functions/_shared/firebase_admin.ts`
- **Supabase database**
- **Firebase Identity Toolkit**
- **SMTP mail service**

### Other components

- **HTTP clients**

## Connections

- HTTP clients → Provision student: posts request
- HTTP clients → First-login OTP: posts request
- Provision student → Firebase auth helper: authenticates caller (evidence: `supabase/functions/provision-student/index.ts`)
- First-login OTP → Firebase auth helper: authenticates caller (evidence: `supabase/functions/first-login-otp/index.ts`)
- Approve teacher → Firebase auth helper: uses auth helper (evidence: `supabase/functions/approve-teacher/index.ts`)
- Complete first login → Firebase auth helper: uses auth helper (evidence: `supabase/functions/complete-first-login/index.ts`)
- Delete Firebase user → Firebase auth helper: uses auth helper (evidence: `supabase/functions/delete-firebase-user/index.ts`)
- Student dashboard → Firebase auth helper: uses auth helper (evidence: `supabase/functions/student-dashboard/index.ts`)
- Update student → Firebase auth helper: uses auth helper (evidence: `supabase/functions/update-student/index.ts`)
- Provision student → Supabase database: reads and writes (evidence: `supabase/functions/provision-student/index.ts`)
- Provision student → Firebase Identity Toolkit: creates account (evidence: `supabase/functions/provision-student/index.ts`)
- Provision student → SMTP mail service: sends credentials (evidence: `supabase/functions/provision-student/index.ts`)
- First-login OTP → Supabase database: reads and verifies OTP (evidence: `supabase/functions/first-login-otp/index.ts`)
- First-login OTP → SMTP mail service: sends code (evidence: `supabase/functions/first-login-otp/index.ts`)
- Firebase auth helper → Firebase Identity Toolkit: validates token (evidence: `supabase/functions/_shared/firebase_admin.ts`)
- Linux shell → Linux plugins: registers plugins
- Windows shell → Windows window: uses window (evidence: `windows/runner/flutter_window.cpp`)
- Windows shell → Windows plugins: registers plugins
