# thegreatpratyush/betterathena architecture

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

- Interactive diagram: https://gitdiagram.com/thegreatpratyush/betterathena
- Repository: https://github.com/thegreatpratyush/betterathena

## Overview

Athena is a desktop exam application. A student grants camera access, takes an exam with a timer and tab-switch monitoring, then submits answers for scoring and a saved result. The React app also captures periodic camera snapshots; Electron provides the isolated IPC bridge, rules dialog, kiosk mode, and local file writes. The sampled excerpts show result persistence and snapshot handling, but not the renderer’s complete camera setup or snapshot-save call, so that connection is left unverified.

Main entry points: [`electron/main.cjs`](https://github.com/thegreatpratyush/betterathena/blob/main/electron/main.cjs) (Electron host), [`src/App.jsx`](https://github.com/thegreatpratyush/betterathena/blob/main/src/App.jsx) (Exam app: setup, exam, results), [`src/main.jsx`](https://github.com/thegreatpratyush/betterathena/blob/main/src/main.jsx) (React renderer entry), [`electron/preload.cjs`](https://github.com/thegreatpratyush/betterathena/blob/main/electron/preload.cjs) (IPC bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_exam["Exam experience"]
  node_exam_app["Exam app: setup, exam, results<br/>[App.jsx]"]
  node_renderer_entry["React renderer entry<br/>[main.jsx]"]
end

subgraph group_desktop["Electron desktop"]
  node_electron_host["Electron host<br/>[main.cjs]"]
  node_ipc_bridge["IPC bridge<br/>[preload.cjs]"]
  node_rules_dialog["Exam rules dialog<br/>[main.cjs]"]
end

subgraph group_persistence["Local persistence"]
  node_photo_files[("Camera snapshot files<br/>[main.cjs]")]
  node_result_files[("Exam result files<br/>[main.cjs]")]
end

node_student(("Student"))
node_camera["Device camera"]

node_student -->|"uses"| node_exam_app
node_renderer_entry -->|"renders"| node_exam_app
node_electron_host -->|"loads renderer"| node_renderer_entry
node_exam_app -.->|"captures from"| node_camera
node_exam_app -->|"requests result save"| node_ipc_bridge
node_ipc_bridge -->|"invokes IPC"| node_electron_host
node_electron_host -->|"shows rules"| node_rules_dialog
node_electron_host -->|"writes snapshots"| node_photo_files
node_electron_host -->|"writes results"| node_result_files

click node_exam_app "https://github.com/thegreatpratyush/betterathena/blob/main/src/App.jsx"
click node_renderer_entry "https://github.com/thegreatpratyush/betterathena/blob/main/src/main.jsx"
click node_electron_host "https://github.com/thegreatpratyush/betterathena/blob/main/electron/main.cjs"
click node_ipc_bridge "https://github.com/thegreatpratyush/betterathena/blob/main/electron/preload.cjs"
click node_rules_dialog "https://github.com/thegreatpratyush/betterathena/blob/main/electron/main.cjs"
click node_photo_files "https://github.com/thegreatpratyush/betterathena/blob/main/electron/main.cjs"
click node_result_files "https://github.com/thegreatpratyush/betterathena/blob/main/electron/main.cjs"

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_exam_app,node_renderer_entry toneBlue
class node_electron_host,node_ipc_bridge,node_rules_dialog toneAmber
class node_photo_files,node_result_files toneMint
class node_student,node_camera toneIndigo
```

## Components

### Exam experience

- [Exam app: setup, exam, results](https://github.com/thegreatpratyush/betterathena/blob/main/src/App.jsx): `src/App.jsx`
- [React renderer entry](https://github.com/thegreatpratyush/betterathena/blob/main/src/main.jsx): `src/main.jsx`

### Electron desktop

- [Electron host](https://github.com/thegreatpratyush/betterathena/blob/main/electron/main.cjs): `electron/main.cjs`
- [IPC bridge](https://github.com/thegreatpratyush/betterathena/blob/main/electron/preload.cjs): `electron/preload.cjs`
- [Exam rules dialog](https://github.com/thegreatpratyush/betterathena/blob/main/electron/main.cjs): `electron/main.cjs`

### Local persistence

- [Camera snapshot files](https://github.com/thegreatpratyush/betterathena/blob/main/electron/main.cjs): `electron/main.cjs`
- [Exam result files](https://github.com/thegreatpratyush/betterathena/blob/main/electron/main.cjs): `electron/main.cjs`

### Other components

- **Student**
- **Device camera**

## Connections

- Student → Exam app: setup, exam, results: uses (evidence: `src/App.jsx`)
- React renderer entry → Exam app: setup, exam, results: renders (evidence: `src/main.jsx`)
- Electron host → React renderer entry: loads renderer (evidence: `electron/main.cjs`)
- Exam app: setup, exam, results → Device camera: captures from
- Exam app: setup, exam, results → IPC bridge: requests result save (evidence: `src/App.jsx`)
- IPC bridge → Electron host: invokes IPC (evidence: `electron/preload.cjs`)
- Electron host → Exam rules dialog: shows rules (evidence: `electron/main.cjs`)
- Electron host → Camera snapshot files: writes snapshots (evidence: `electron/main.cjs`)
- Electron host → Exam result files: writes results (evidence: `electron/main.cjs`)
