# maxephraim09/nays-cbt-v1.01 architecture

> Architecture diagram of the GitHub repository maxephraim09/nays-cbt-v1.01, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maxephraim09/nays-cbt-v1.01
- Repository: https://github.com/maxephraim09/nays-cbt-v1.01

## Overview

NAYS 2.0 is a Flutter learning and computer-based testing application, with Firebase-backed services and native platform runners. The intended learner workflow is subject selection, exam delivery, answer submission, scoring, and leaderboard updates; the README also describes offline practice and locally stored question banks. Flutter feature source is absent from the supplied tree, so those client-side components are documented-only and have null paths. Backend exam behavior and Windows startup are supported by excerpts; other app-client links rely on the README rather than inspected Flutter code.

Main entry points: [`functions/src/index.ts`](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts) (Exam session service), [`functions/src/exam_logic.ts`](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/exam_logic.ts) (Exam logic), [`windows/runner/main.cpp`](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/windows/runner/main.cpp) (Windows runner), [`android/app/src/main/kotlin/com/nays/nays_mobile/MainActivity.kt`](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/android/app/src/main/kotlin/com/nays/nays_mobile/MainActivity.kt) (Android activity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Learner app"]
  node_app["NAYS app"]
  node_windows["Windows runner<br/>[main.cpp]"]
  node_android["Android activity<br/>[MainActivity.kt]"]
  node_subject["Subject selection"]
  node_preferences["Exam preferences"]
  node_history["Exam history"]
end

subgraph group_local["Offline learning"]
  node_questionbank[("Local question bank")]
  node_offlineexam["Offline practice"]
end

subgraph group_backend["Exam services"]
  node_examservice["Exam session service<br/>[index.ts]"]
  node_examlogic["Exam logic<br/>[exam_logic.ts]"]
  node_answers["Answer submission<br/>[index.ts]"]
end

subgraph group_cloud["Cloud data"]
  node_results[("Exam results<br/>[index.ts]")]
  node_profiles[("User profiles<br/>[index.ts]")]
  node_leaderboard[("Leaderboards<br/>[index.ts]")]
end

node_learner(("Learner"))
node_firebase[("Firebase")]

node_learner -->|"uses"| node_app
node_app -->|"starts through"| node_windows
node_app -.->|"runs on"| node_android
node_app -->|"selects"| node_subject
node_app -->|"configures"| node_preferences
node_subject -->|"starts exam"| node_examservice
node_preferences -->|"sets exam options"| node_examservice
node_app -->|"loads locally"| node_questionbank
node_questionbank -->|"supplies questions"| node_offlineexam
node_examservice -->|"reads and writes"| node_firebase
node_examservice -->|"selects questions"| node_examlogic
node_examservice -->|"reads profile"| node_profiles
node_examservice -->|"accepts answers"| node_answers
node_answers -->|"grades answers"| node_examlogic
node_answers -->|"stores result"| node_results
node_results -->|"supports review"| node_history
node_results -->|"updates standings"| node_leaderboard
node_app -->|"syncs account data"| node_profiles
node_app -->|"shows standings"| node_leaderboard

click node_windows "https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/windows/runner/main.cpp"
click node_android "https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/android/app/src/main/kotlin/com/nays/nays_mobile/MainActivity.kt"
click node_examservice "https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts"
click node_examlogic "https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/exam_logic.ts"
click node_answers "https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts"
click node_results "https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts"
click node_profiles "https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts"
click node_leaderboard "https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.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_app,node_windows,node_android,node_subject,node_preferences,node_history toneBlue
class node_questionbank,node_offlineexam,node_firebase toneAmber
class node_examservice,node_examlogic,node_answers toneMint
class node_results,node_profiles,node_leaderboard toneRose
class node_learner toneIndigo
```

## Components

### Learner app

- **NAYS app**
- [Windows runner](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/windows/runner/main.cpp): `windows/runner/main.cpp`
- [Android activity](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/android/app/src/main/kotlin/com/nays/nays_mobile/MainActivity.kt): `android/app/src/main/kotlin/com/nays/nays_mobile/MainActivity.kt`
- **Subject selection**
- **Exam preferences**
- **Exam history**

### Offline learning

- **Local question bank**
- **Offline practice**

### Exam services

- [Exam session service](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts): `functions/src/index.ts`
- [Exam logic](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/exam_logic.ts): `functions/src/exam_logic.ts`
- [Answer submission](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts): `functions/src/index.ts`

### Cloud data

- [Exam results](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts): `functions/src/index.ts`
- [User profiles](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts): `functions/src/index.ts`
- [Leaderboards](https://github.com/maxephraim09/nays-cbt-v1.01/blob/main/functions/src/index.ts): `functions/src/index.ts`

### Other components

- **Learner**
- **Firebase**

## Connections

- Learner → NAYS app: uses
- NAYS app → Windows runner: starts through (evidence: `windows/runner/main.cpp`)
- NAYS app → Android activity: runs on
- NAYS app → Subject selection: selects
- NAYS app → Exam preferences: configures
- Subject selection → Exam session service: starts exam (evidence: `functions/src/index.ts`)
- Exam preferences → Exam session service: sets exam options (evidence: `functions/src/index.ts`)
- NAYS app → Local question bank: loads locally
- Local question bank → Offline practice: supplies questions
- Exam session service → Firebase: reads and writes (evidence: `functions/src/index.ts`)
- Exam session service → Exam logic: selects questions (evidence: `functions/src/index.ts`)
- Exam session service → User profiles: reads profile (evidence: `functions/src/index.ts`)
- Exam session service → Answer submission: accepts answers (evidence: `functions/src/index.ts`)
- Answer submission → Exam logic: grades answers (evidence: `functions/src/index.ts`)
- Answer submission → Exam results: stores result (evidence: `functions/src/index.ts`)
- Exam results → Exam history: supports review
- Exam results → Leaderboards: updates standings (evidence: `functions/src/index.ts`)
- NAYS app → User profiles: syncs account data
- NAYS app → Leaderboards: shows standings
