# moseoridev/icampuscheck architecture

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

- Interactive diagram: https://gitdiagram.com/moseoridev/icampuscheck
- Repository: https://github.com/moseoridev/icampuscheck

## Overview

##### Main Components
- Background Script (background.js): Acts as the core controller. It handles browser events, manages caching, and coordinates asynchronous requests for performance improvement.
- Content Script (content.js): Injects code into canvas.skku.edu pages to extract course information from the designated tab (“강의콘텐츠”). It is the link between the extension and the web page’s DOM.
- Auxiliary Scripts (executescript.js & utils.js): These scripts contain utility functions and extra execution logic to facilitate core operations such as DOM manipulations, asynchronous operations, or data formatting.
- Dependency/Build Management: Files like package.json, pnpm-lock.yaml, .prettierrc, and .prettierignore indicate that the project uses JavaScript tooling for ensuring code quality and managing dependencies.

##### Understand the Component Interactions
- The manifest.json defines the behavior and permissions, linking to the background script, content script, and popup UI.
- The background script performs asynchronous operations (parallel requests, caching data) and communicates with both the popup UI and content scripts via message passing.
- The content script interacts directly with the target website (canvas.skku.edu), retrieving information from the "강의콘텐츠" tab.
- The popup script gathers processed data from the background or content scripts and renders the user interface for deadlines, including features like dark mode and visual emphasis on items with impending deadlines.
- Utilities and execution helper scripts provide supporting functions used by both foreground and background components.

##### Architectural Patterns and Key Design Principles
- Modular Design: Each script (background, content, popup, utilities) serves a distinct role, ensuring separation of concerns.
- Asynchronous & Event-Driven Behavior: Highlight how parallel asynchronous requests improve performance and how event listeners trigger reactive behaviors.
- Caching Strategy: Emphasize the use of caching mechanisms so that reopened windows don’t trigger full reloads.
- Manifest V3 Compliance: Note how the manifest governs permissions, service workers (if used), and updated extension APIs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Chrome Extension Core"
        M("Manifest"):::config
        BS("Background Script"):::service
        CS("Content Script"):::service
        subgraph "Popup UI"
            PU_HTML("Popup HTML"):::ui
            PU_JS("Popup Script"):::ui
        end
        AS("Auxiliary Scripts"):::aux
    end

    subgraph "External & Supporting"
        CT("Canvas - 강의콘텐츠 Tab"):::external
    end

    subgraph "Dependency/Build Management"
        PK("package.json"):::build
        PN("pnpm-lock.yaml"):::build
        PRC(".prettierrc"):::build
        PRI(".prettierignore"):::build
    end

    subgraph "Assets"
        ICONS("Icons"):::asset
        IMAGES("Images"):::asset
    end

    %% Main orchestration by Manifest
    M -->|"declares"| BS
    M -->|"declares"| CS
    M -->|"declares"| PU_HTML
    M -->|"declares"| PU_JS

    %% Component interactions
    CS -->|"scrapes"| CT
    CS -->|"sendsData"| BS
    BS <-->|"uiComm"| PU_HTML
    BS <-->|"uiComm"| PU_JS

    %% Auxiliary support connections
    AS ---|"supports"| BS
    AS ---|"supports"| CS
    AS ---|"supports"| PU_HTML
    AS ---|"supports"| PU_JS

    %% Build and Asset integrations
    PK --- M
    PN --- M
    PRC --- M
    PRI --- M
    ICONS --- M
    IMAGES --- M

    %% Styles
    classDef config fill:#a9d08e,stroke:#333,stroke-width:2px;
    classDef service fill:#dae8fc,stroke:#6c8ebf,stroke-width:2px;
    classDef ui fill:#f8cecc,stroke:#b85450,stroke-width:2px;
    classDef aux fill:#fff2cc,stroke:#d6b656,stroke-width:2px;
    classDef build fill:#d9ead3,stroke:#6aa84f,stroke-width:2px;
    classDef asset fill:#ead1dc,stroke:#b97a95,stroke-width:2px;
    classDef external fill:#f4cccc,stroke:#e06666,stroke-width:2px;

    %% Click Events
    click M "https://github.com/moseoridev/icampuscheck/blob/master/manifest.json"
    click BS "https://github.com/moseoridev/icampuscheck/blob/master/background.js"
    click CS "https://github.com/moseoridev/icampuscheck/blob/master/content.js"
    click PU_HTML "https://github.com/moseoridev/icampuscheck/blob/master/popup.html"
    click PU_JS "https://github.com/moseoridev/icampuscheck/blob/master/script.js"
    click AS "https://github.com/moseoridev/icampuscheck/blob/master/executescript.js"
    click AS "https://github.com/moseoridev/icampuscheck/blob/master/utils.js"
    click ICONS "https://github.com/moseoridev/icampuscheck/tree/master/icons"
    click IMAGES "https://github.com/moseoridev/icampuscheck/tree/master/images"
    click PK "https://github.com/moseoridev/icampuscheck/blob/master/package.json"
    click PN "https://github.com/moseoridev/icampuscheck/blob/master/pnpm-lock.yaml"
    click PRC "https://github.com/moseoridev/icampuscheck/blob/master/.prettierrc"
    click PRI "https://github.com/moseoridev/icampuscheck/blob/master/.prettierignore"
```
