# tcstenungsund/schedule architecture

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

- Interactive diagram: https://gitdiagram.com/tcstenungsund/schedule
- Repository: https://github.com/tcstenungsund/schedule

## Overview

##### Project type and purpose
- This is a static, full-stack-in-the-browser scheduling application published via GitHub Pages.
- It uses TypeScript-based web components (built with Rollup), plain HTML/CSS, and markdown files (schedules and assignments) as its data source.

##### Main components of the system
a. Build pipeline
- TypeScript sources (components/src)
- Rollup configuration (components/rollup.config.mjs)
- Output bundle (components/dist/index.js + .d.ts types)
b. Hosting / Delivery
- GitHub Pages (serving the static site)
c. Client runtime (Browser)
- HTML shell pages load CSS and the JS bundle
- JS bundle instantiates web components:
- <schedule-preview> (loads schedule markdown)
- <assignment> (loads individual assignment markdown)
- <navbar> (navigation UI)
- md-converter (converts markdown to HTML at runtime)
- APIs (schedule-api.ts, assignment-api.ts) that fetch raw .md via HTTP
d. Data layer
- Markdown files under md/ (templates, assignments, schedules)
- CSS under css/
- Static assets under resources/

##### Relationships & interactions
- Build: components/src (.ts) → Rollup → components/dist (index.js)
- Deployment: dist/ + HTML/CSS/md/resources → GitHub Pages
- At runtime: Browser requests an HTML page → CSS + dist/index.js + markdown assets → JS APIs fetch .md files over HTTP → md-converter parses content → web components render schedules/assignments

##### Architectural patterns & design principles
- Component-based UI (web components in TypeScript)
- Static-site-as-application: no custom backend; markdown is the “API”
- Separation of concerns:
- Build/configuration (Rollup + tsconfig.json)
- Presentation (HTML + CSS)
- Data/model (markdown + lightweight JS APIs)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & CI/CD
    subgraph "Build & CI/CD"
        TSsource["TypeScript Sources"]:::build
        RollupConfig["Rollup Configuration"]:::build
        BundleJS["JS Bundle (index.js)"]:::build
        BundleTypes["Type Definitions"]:::build

        TSsource -->|"compiles via"| RollupConfig
        RollupConfig -->|"outputs"| BundleJS
        RollupConfig -->|"outputs"| BundleTypes
    end

    %% Hosting Layer
    subgraph "Hosting (GitHub Pages)"
        GitHubPages["GitHub Pages Hosting"]:::infra
        IndexHTML["index.html"]:::doc
        ScheduleHTML["schedule.html"]:::doc
        AssignmentHTML["assignment.html"]:::doc
        ExternalHTML["external.html"]:::doc
        CSS["CSS Stylesheets"]:::infra
        Resources["Static Assets"]:::infra
        MDstore["Markdown Data Store"]:::data

        BundleJS -->|"deploys"| GitHubPages
        BundleTypes -->|"deploys"| GitHubPages
        IndexHTML -->|"deploys"| GitHubPages
        ScheduleHTML -->|"deploys"| GitHubPages
        AssignmentHTML -->|"deploys"| GitHubPages
        ExternalHTML -->|"deploys"| GitHubPages
        CSS -->|"deploys"| GitHubPages
        Resources -->|"deploys"| GitHubPages
        MDstore -->|"deploys"| GitHubPages
    end

    %% Client Runtime
    subgraph "Client Runtime (Browser)" 
        Browser["Browser"]:::client

        GitHubPages -->|"serves HTML/CSS/JS/.md"| Browser

        subgraph "JS Runtime"
            SchedulePreview["<schedule-preview>"]:::clientComp
            AssignmentComp["<assignment>"]:::clientComp
            NavbarComp["<navbar>"]:::clientComp
            MDconverter["md-converter"]:::clientComp
            ScheduleAPI["schedule-api"]:::clientComp
            AssignmentAPI["assignment-api"]:::clientComp
            CommonStyles["Common Styles Module"]:::clientComp

            Browser -->|"loads"| SchedulePreview
            Browser -->|"loads"| AssignmentComp
            Browser -->|"loads"| NavbarComp
            Browser -->|"loads"| MDconverter
            Browser -->|"loads"| ScheduleAPI
            Browser -->|"loads"| AssignmentAPI
            Browser -->|"loads"| CommonStyles

            ScheduleAPI -->|"fetches .md"| MDstore
            AssignmentAPI -->|"fetches .md"| MDstore
            MDconverter -->|"parses markdown"| SchedulePreview
            MDconverter -->|"parses markdown"| AssignmentComp
            SchedulePreview -->|"renders view"| Browser
            AssignmentComp -->|"renders view"| Browser
        end

        Browser -->|"edit source"| GitHubEditor["GitHub Online Editor"]:::external
    end

    %% Click Events
    click TSsource "https://github.com/tcstenungsund/schedule/tree/main/components/src"
    click RollupConfig "https://github.com/tcstenungsund/schedule/blob/main/components/rollup.config.mjs"
    click BundleJS "https://github.com/tcstenungsund/schedule/blob/main/components/dist/index.js"
    click BundleTypes "https://github.com/tcstenungsund/schedule/tree/main/components/dist/types"
    click IndexHTML "https://github.com/tcstenungsund/schedule/blob/main/index.html"
    click ScheduleHTML "https://github.com/tcstenungsund/schedule/blob/main/schedule.html"
    click AssignmentHTML "https://github.com/tcstenungsund/schedule/blob/main/assignment.html"
    click ExternalHTML "https://github.com/tcstenungsund/schedule/blob/main/external.html"
    click CSS "https://github.com/tcstenungsund/schedule/tree/main/css/"
    click Resources "https://github.com/tcstenungsund/schedule/tree/main/resources/"
    click MDstore "https://github.com/tcstenungsund/schedule/tree/main/md/"
    click SchedulePreview "https://github.com/tcstenungsund/schedule/blob/main/components/src/schedule-preview/schedule-preview.ts"
    click AssignmentComp "https://github.com/tcstenungsund/schedule/blob/main/components/src/assignment/assignment.ts"
    click NavbarComp "https://github.com/tcstenungsund/schedule/blob/main/components/src/navbar/navbar.ts"
    click MDconverter "https://github.com/tcstenungsund/schedule/blob/main/components/src/common/md-converter.ts"
    click ScheduleAPI "https://github.com/tcstenungsund/schedule/blob/main/components/src/common/schedule-api.ts"
    click AssignmentAPI "https://github.com/tcstenungsund/schedule/blob/main/components/src/common/assignment-api.ts"
    click CommonStyles "https://github.com/tcstenungsund/schedule/blob/main/components/src/common/styles.ts"

    %% Styles
    classDef build fill:#D0E8FF,stroke:#0066CC,stroke-width:1px
    classDef infra fill:#DFFFD0,stroke:#669900,stroke-width:1px
    classDef client fill:#FFF8D0,stroke:#CC9900,stroke-width:1px
    classDef clientComp fill:#FFF2CC,stroke:#CC9900,stroke-width:1px
    classDef data fill:#FFE8CC,stroke:#CC6600,stroke-width:1px
    classDef doc fill:#F0F0F0,stroke:#999999,stroke-width:1px,stroke-dasharray: 2 2
    classDef external fill:#E8E8E8,stroke:#666666,stroke-width:1px,stroke-dasharray: 2 2
```
