# yuvii-b/gpa-calc architecture

> Architecture diagram of the GitHub repository yuvii-b/gpa-calc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yuvii-b/gpa-calc
- Repository: https://github.com/yuvii-b/gpa-calc

## Overview

##### Project type and purpose
- Type: Client-side static web application
- Purpose: Let students compute Semester GPA (SGPA) and Cumulative GPA (CGPA) entirely in the browser using HTML, CSS, and JavaScript

##### File structure
- Top-level files:
– index.html: Landing/home page
– sgpa.html & sgpa.js: SGPA calculation page and its script
– cgpa.html & cgpa.js: CGPA calculation page and its script
– style.css: Shared stylesheet
– LICENSE, README.md: Meta documentation
- No server-side code, databases, or external services
- All computation happens client-side via JavaScript

##### README for additional insights
- Confirms tool is purely front-end
- No dependencies beyond vanilla HTML/CSS/JS

a. Main components:
1. User’s Web Browser (Client)
2. Static File Server (could be GitHub Pages, any HTTP server)
3. Static assets:
– HTML pages (index.html, sgpa.html, cgpa.html)
– JavaScript modules (sgpa.js, cgpa.js)
– CSS (style.css)
b. Relationships & interactions:
- Browser “→” Server: HTTP GET requests for HTML, CSS, JS
- Server “→” Browser: Serves static files
- Browser internal flow:
– User navigates to index.html / sgpa.html / cgpa.html
– Browser loads style.css for UI styling
– Browser executes sgpa.js or cgpa.js for calculations
– JS reads form input, computes GPA, updates DOM
c. Architectural patterns / principles:
- Static asset hosting (no backend)
- Client-side MVC notion:
– View: HTML + CSS
– Controller/Model: JavaScript functions in sgpa.js / cgpa.js
d. Key technologies:
- HTML5 for structure
- CSS for styling
- Vanilla JavaScript for business logic

##### Detailed breakdown
Layer 1: Client/Server boundary
[User’s Browser] ←── HTTP GET /index.html, /sgpa.html, /cgpa.html ──→ [Static File Server]
[User’s Browser] ←── style.css ──→
[User’s Browser] ←── sgpa.js / cgpa.js ──→
(HTML + CSS UI)
↑
| “include”
↓
(JavaScript logic: sgpa.js / cgpa.js)
↑
| “reads form fields”
| “computes GPA”
↓
(DOM update: show result)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Network elements
    Browser["User's Browser"]:::network
    Server["Static File Server"]:::network

    %% Static assets on Server
    subgraph "Static File Server"
        direction TB
        HTMLindex["index.html"]:::asset
        HTMLsgpa["sgpa.html"]:::asset
        HTMLcgpa["cgpa.html"]:::asset
        CSS["style.css"]:::asset
        JSsgpa["sgpa.js"]:::asset
        JScgpa["cgpa.js"]:::asset
        README["README.md"]:::doc
        LICENSE["LICENSE"]:::doc
    end

    %% Client-Server interactions
    Browser -->|"GET index.html / sgpa.html / cgpa.html"| Server
    Server -->|"Serves HTML pages"| Browser
    Browser -->|"GET style.css"| Server
    Server -->|"Serves CSS"| Browser
    Browser -->|"GET sgpa.js / cgpa.js"| Server
    Server -->|"Serves JS modules"| Browser

    %% In-Browser flow
    subgraph "In-Browser Flow"
        direction TB
        HTMLUI["HTML Pages + CSS UI"]:::asset
        JSlogic["JavaScript Logic (sgpa.js / cgpa.js)"]:::asset
        DOM["DOM Update (Display GPA)"]:::asset

        HTMLUI -->|"includes JS modules"| JSlogic
        JSlogic -->|"reads form fields and computes GPA"| DOM
        DOM -->|"updates UI"| HTMLUI
    end

    %% Nest In-Browser within Browser
    Browser --> HTMLUI

    %% Click Events
    click HTMLindex "https://github.com/yuvii-b/gpa-calc/blob/main/index.html"
    click HTMLsgpa "https://github.com/yuvii-b/gpa-calc/blob/main/sgpa.html"
    click HTMLcgpa "https://github.com/yuvii-b/gpa-calc/blob/main/cgpa.html"
    click JSsgpa "https://github.com/yuvii-b/gpa-calc/blob/main/sgpa.js"
    click JScgpa "https://github.com/yuvii-b/gpa-calc/blob/main/cgpa.js"
    click CSS "https://github.com/yuvii-b/gpa-calc/blob/main/style.css"
    click README "https://github.com/yuvii-b/gpa-calc/blob/main/README.md"
    click LICENSE "https://github.com/yuvii-b/gpa-calc/tree/main/LICENSE"

    %% Styles
    classDef network fill:#E8F1FA,stroke:#3498DB,stroke-width:1px
    classDef asset fill:#E8F8E0,stroke:#2ECC71,stroke-width:1px
    classDef doc fill:#FEF9E7,stroke:#F1C40F,stroke-width:1px
```
