# bildungsportal/next-exam architecture

> Architecture diagram of the GitHub repository bildungsportal/next-exam, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bildungsportal/next-exam
- Repository: https://github.com/bildungsportal/next-exam

## Overview

##### Major components
a. Electron Application Shell – This encapsulates both the student and teacher versions. Each version includes:
– The Main Process (Electron’s background process that manages application windows, native integrations, and some system-level functions).
– The Renderer Process (the frontend built in Vue; note the renderer directories with Vite configurations and Vue component files).
– Preload Scripts (used to securely bridge Node APIs to the renderer process; present in packages/preload).
c. Native Modules and Utilities – For example, the “disable-shortcuts” project written in C (and managed via CMake files in student/disable-shortcuts) that likely handles secure input or keyboard restrictions.
d. Third-party integrations – This includes the integration of LanguageTool (present under public/LanguageTool), which is provided as a set of JAR files and native libraries.
e. Build and Deployment Tools – Tools like electron-builder (with configuration files such as electron-builder.yml), Vite, and build scripts (like build.mjs and prebuild.js) that handle assembly and distribution.
f. Supporting Runtime Environments – Minimal JRE distributions (for Linux, Mac, Win) are packaged as part of the public files. They are critical for any Java-based components (such as LanguageTool).

##### Relationships and data flows
– Represent the Vue-based UI (renderer) as the interactive layer where candidates or teachers interact with the system.
– Include the integration of the LanguageTool libraries (packaged as JAR files and dependent libraries) as an external or embedded service that either the main process (or the server) communicates with for grammar checks or language processing.
– Indicate that build tools (electron-builder, Vite, CMake) are used for compiling the different parts, but these can be represented as a side component that feeds into both the development and production pipelines.

- Two main application variants (“student” and “teacher”) each with:
– An Electron shell containing:
- Main process (managing window creation, native integrations, etc.)
- Renderer (user interface built with Vue)
- Preload scripts (enabling secure API access)
- In the teacher application, an additional Node/Express server component handling exam control, routing (located in teacher/packages/server).
- LanguageTool components (included as jars and supporting libraries in public/LanguageTool) that can be depicted as either a local embedded service or an external API.
- A native module component (the disable-shortcuts module) integrated into the student application.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build and Deployment Tools
    BuildTools["Build & Deployment Tools"]:::build

    %% Student Application Subgraph
    subgraph "Student Application"
        Student_Main["Electron Main Process (Student)"]:::electron
        Student_Preload["Preload Scripts (Student)"]:::preload
        Student_Renderer["Renderer (Vue) (Student)"]:::renderer
        Native_Module["Native Module: disable-shortcuts"]:::native
    end

    %% Teacher Application Subgraph
    subgraph "Teacher Application"
        Teacher_Main["Electron Main Process (Teacher)"]:::electron
        Teacher_Preload["Preload Scripts (Teacher)"]:::preload
        Teacher_Renderer["Renderer (Vue) (Teacher)"]:::renderer
        Express_Backend["Node/Express Backend (Teacher)"]:::backend
    end

    %% External Components
    LanguageTool["LanguageTool Integration"]:::thirdparty
    MinimalJRE["Minimal JRE Distributions"]:::runtime

    %% Data Flows for Student Application
    BuildTools -->|"builds"| Student_Main
    Student_Main -->|"loads"| Student_Preload
    Student_Main -->|"launches"| Student_Renderer
    Student_Main -->|"invokes"| Native_Module
    Student_Main -->|"grammarCheck"| LanguageTool

    %% Data Flows for Teacher Application
    BuildTools -->|"builds"| Teacher_Main
    Teacher_Main -->|"loads"| Teacher_Preload
    Teacher_Main -->|"launches"| Teacher_Renderer
    Teacher_Renderer -->|"API_Call"| Express_Backend
    Teacher_Main -->|"grammarCheck"| LanguageTool
    Express_Backend -->|"processes"| LanguageTool

    %% Build Tools to Runtime
    BuildTools -->|"packages"| MinimalJRE

    %% Click Events
    click Student_Main "https://github.com/bildungsportal/next-exam/blob/main/student/packages/main/main.js"
    click Student_Renderer "https://github.com/bildungsportal/next-exam/tree/main/student/packages/renderer/"
    click Student_Preload "https://github.com/bildungsportal/next-exam/tree/main/student/packages/preload/"
    click Teacher_Main "https://github.com/bildungsportal/next-exam/blob/main/teacher/packages/main/main.ts"
    click Teacher_Renderer "https://github.com/bildungsportal/next-exam/tree/main/teacher/packages/renderer/"
    click Teacher_Preload "https://github.com/bildungsportal/next-exam/tree/main/teacher/packages/preload/"
    click Express_Backend "https://github.com/bildungsportal/next-exam/tree/main/teacher/packages/server/"
    click Native_Module "https://github.com/bildungsportal/next-exam/tree/main/student/disable-shortcuts/"
    click LanguageTool "https://github.com/bildungsportal/next-exam/tree/main/teacher/public/LanguageTool/"
    click BuildTools "https://github.com/bildungsportal/next-exam/blob/main/student/electron-builder.yml"
    click MinimalJRE "https://github.com/bildungsportal/next-exam/tree/main/student/public/minimal-jre-*"

    %% Styles
    classDef electron fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef renderer fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef preload fill:#ccccff,stroke:#333,stroke-width:2px;
    classDef backend fill:#ffe6cc,stroke:#333,stroke-width:2px;
    classDef native fill:#ffebcc,stroke:#333,stroke-width:2px;
    classDef thirdparty fill:#d9f2d9,stroke:#333,stroke-width:2px;
    classDef build fill:#e6e6fa,stroke:#333,stroke-width:2px;
    classDef runtime fill:#fff2cc,stroke:#333,stroke-width:2px;
```
