# node-recipes/llm-based-autograder architecture

> Architecture diagram of the GitHub repository node-recipes/llm-based-autograder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/node-recipes/llm-based-autograder
- Repository: https://github.com/node-recipes/llm-based-autograder

## Overview

##### Main Components

a) Input Layer:
- GitHub Classroom submission files
- Prompt configuration files (from /prompts directory)
- File references system (for embedding additional files)

b) Core Processing Components:
- GitHub Action Runtime Environment
- Prompt Processing System
- LLM Integration Service
- File Resolution System

c) Output Layer:
- Grading Results
- GitHub Classroom Integration

##### Component Relationships

- How the GitHub Action receives input from GitHub Classroom
- Prompt processing pipeline:
- Prompt file loading (/prompts directory)
- File reference resolution ({{file}} syntax handling)
- LLM interaction
- Grading result flow back to GitHub Classroom

##### Technical Implementation Details

- TypeScript-based components (indicated by .ts files in /src)
- Configuration elements (.env, action.yml)
- Build artifacts (dist/ directory)
- External services (LLM API)

##### Specific Architectural Elements

Create sections showing:
- The action's initialization flow (src/main.ts → src/index.ts)
- Configuration management (.env.example, action.yml)
- Build pipeline (rollup.config.ts, tsconfig files)
- CI/CD integration (.github/workflows)

**[GitHub Classroom] → [Action Trigger]**
- ↓
**[Input Processing]**
- Submission Files
- Prompt Configuration
- File References
- ↓
**[Core Processing]**
- Prompt Resolution
- LLM Integration
- Grading Logic
- ↓
**[Result Generation]**
- Grade Calculation
- Feedback Formation
- ↓
**[GitHub Classroom Integration]**

##### Technical Stack Indicators

- TypeScript
- GitHub Actions
- LLM Provider
- Node.js runtime

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        GCS[GitHub Classroom Submission]:::github
        PC[Prompt Configuration Files]:::file
        RF[Reference Files]:::file
    end

    subgraph "GitHub Action Environment"
        AC[action.yml]:::config
        ENV[.env Configuration]:::config
        
        subgraph "Core Processing"
            EP["Entry Point"]:::core
            ML["Main Logic"]:::core
            CO["Compiled Output"]:::core
        end
        
        subgraph "Build System"
            TS["TypeScript Config"]:::build
            RC["Rollup Config"]:::build
        end
        
        subgraph "Prompt Processing"
            SP["Student Prompts"]:::prompt
            TP["Task Prompts"]:::prompt
        end
    end

    subgraph "External Services"
        LLM[LLM Service]:::llm
    end

    subgraph "CI/CD"
        WF["Workflow Definitions"]:::cicd
        DC["Distribution Check"]:::cicd
    end

    subgraph Output
        GR[Grading Results]:::output
        GCI[GitHub Classroom Integration]:::output
    end

    GCS --> EP
    PC --> SP
    PC --> TP
    RF --> EP
    
    EP --> ML
    ML --> CO
    SP --> ML
    TP --> ML
    
    ML --> LLM
    LLM --> GR
    GR --> GCI

    classDef github fill:#4a9eff,stroke:#333,stroke-width:2px
    classDef file fill:#ff9e3d,stroke:#333,stroke-width:2px
    classDef config fill:#f9c74f,stroke:#333,stroke-width:2px
    classDef core fill:#90be6d,stroke:#333,stroke-width:2px
    classDef build fill:#f94144,stroke:#333,stroke-width:2px
    classDef prompt fill:#9b5de5,stroke:#333,stroke-width:2px
    classDef llm fill:#577590,stroke:#333,stroke-width:2px
    classDef cicd fill:#277da1,stroke:#333,stroke-width:2px
    classDef output fill:#43aa8b,stroke:#333,stroke-width:2px

    click AC "https://github.com/node-recipes/llm-based-autograder/blob/main/action.yml"
    click ENV "https://github.com/node-recipes/llm-based-autograder/blob/main/.env.example"
    click EP "https://github.com/node-recipes/llm-based-autograder/blob/main/src/index.ts"
    click ML "https://github.com/node-recipes/llm-based-autograder/blob/main/src/main.ts"
    click CO "https://github.com/node-recipes/llm-based-autograder/blob/main/dist/index.js"
    click TS "https://github.com/node-recipes/llm-based-autograder/blob/main/tsconfig.json"
    click RC "https://github.com/node-recipes/llm-based-autograder/blob/main/rollup.config.ts"
    click SP "https://github.com/node-recipes/llm-based-autograder/blob/main/prompts/student.prompt"
    click TP "https://github.com/node-recipes/llm-based-autograder/blob/main/prompts/task.prompt"
    click WF "https://github.com/node-recipes/llm-based-autograder/blob/main/.github/workflows/ci.yml"
    click DC "https://github.com/node-recipes/llm-based-autograder/blob/main/.github/workflows/check-dist.yml"
```
