# mike-north/typescript-courses architecture

> Architecture diagram of the GitHub repository mike-north/typescript-courses, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mike-north/typescript-courses
- Repository: https://github.com/mike-north/typescript-courses

## Overview

##### High‐Level Overview
- Monorepo Root
– Yarn Workspaces & Plugins (.yarnrc.yml, plugins/*.cjs)
– Common configurations: tsconfig.json, .eslint*, Prettier, MarkdownLint
– GitHub actions (ci-website.yml, nightly-compatibility.yml, CodeQL)
- CI/CD Pipeline
– GitHub Actions → Lint → Type-check → Test → Build & Deploy

##### Main Components
A. Chat Sample App (packages/chat)
– Frontend
- Parcel build pipeline (.parcelrc)
- React UI (App.jsx + components/)
- Tailwind CSS (tailwind.config.js)
- Static assets & index.html
– Backend API Server
- Node.js + ES modules (api-server.mjs, index.mjs)
- Local JSON DB (db.json)
- HTTP endpoints consumed by UI
– Tests
- Jest + React Testing Library under packages/chat/tests
- Unit tests for data, utils, components

B. Static Website (packages/website)
– Content layer
- Markdown files under content/blog, courses.yml, etc.
- Images and static assets
– Build pipeline
- Gatsby (gatsby-config.js, gatsby-node.js, gatsby-browser.js)
- GraphQL data layer → React templates (src/templates/)
- Custom webpack/jest loaders (jest-preprocess.js)
– Tests & E2E
- Jest component tests (src/components/__tests__)
- Cypress E2E tests (cypress/)

C. Learning Modules (packages/*-ts, notes-*, hello-ts, http-error, welcome-to-ts)
– Individual TypeScript libraries / code examples
– Each with its own tsconfig.json, package.json
– Serve as in‐repo dependencies or standalone npm packages
– No runtime service; authors run tsc or import them in demos

##### Interactions & Data Flows
– Developer → clones repo → yarn install
– yarn workspace commands (yarn dev-chat, yarn dev-website) invoke package‐specific dev servers
– Chat UI ↔ HTTP calls ↔ Chat API ↔ JSON DB
– Website build: Markdown → GraphQL → React → Static HTML → served locally or deployed
– Learning modules compiled by tsc, imported by demos or website examples

##### Architectural Patterns & Principles
– Monorepo via Yarn Workspaces for shared dependencies and versioning
– Clear separation of concerns: frontend vs. backend vs. static site vs. library packages
– Standard TS project layout: src/, tests/, tsconfig.json per package
– Build‐time code generation (Gatsby GraphQL) vs. runtime server (Chat API)
– CI pipeline enforcing lint, type safety, tests, and site build

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Left: Developer & CI/CD
    subgraph "Developer & CI/CD"
        direction TB
        Dev["Developer"]:::actor
        CI["GitHub Actions"]:::ci
        Lint["Lint"]:::ci
        TypeCheck["Type-check"]:::ci
        TestCI["Test"]:::ci
        BuildDeploy["Build & Deploy"]:::ci
        Dev -->|clones & yarn install| MonorepoRoot
        CI -->|runs| Lint -->|runs| TypeCheck -->|runs| TestCI -->|runs| BuildDeploy
    end

    %% Center: Monorepo Root
    subgraph "Monorepo Root" 
        direction TB
        MonorepoRoot["Yarn Workspaces"]:::tool
        Plugins["Plugins"]:::tool
        CommonConfigs["Common Configs"]:::config
        CIConfigs[".github workflows"]:::config
    end
    MonorepoRoot --> Plugins
    MonorepoRoot --> CommonConfigs
    MonorepoRoot --> CIConfigs

    %% Right: Chat Sample App
    subgraph "Chat Sample App (packages/chat)"
        direction TB
        subgraph "Frontend" 
            direction TB
            Parcel["Parcel Build"]:::build
            ReactUI["React UI"]:::runtime
            Tailwind["Tailwind CSS"]:::build
            Assets["Static Assets"]:::data
            IndexHTML["index.html"]:::data
        end
        subgraph "Backend API Server"
            direction TB
            APIServer["API Server"]:::runtime
            JSONDB["db.json"]:::data
        end
        subgraph "Tests"
            direction TB
            ChatTests["Jest Tests"]:::test
        end
    end

    %% Right: Static Website
    subgraph "Static Website (packages/website)"
        direction TB
        subgraph "Content Layer"
            direction TB
            Markdown["Markdown & YAML"]:::data
        end
        subgraph "Build Pipeline"
            direction TB
            Gatsby["Gatsby"]:::build
            GraphQL["GraphQL"]:::runtime
        end
        subgraph "Templates & Components"
            direction TB
            Templates["React Templates"]:::runtime
        end
        subgraph "Tests & E2E"
            direction TB
            WebsiteTests["Jest & Cypress"]:::test
        end
    end

    %% Right: Learning Modules
    subgraph "Learning Modules (packages/*-ts)"
        direction TB
        Libraries["TypeScript Libraries"]:::library
    end

    %% Interactions
    Dev -->|yarn dev-chat| Parcel
    Dev -.->|yarn dev-chat| APIServer
    ReactUI -->|HTTP| APIServer -->|reads/writes| JSONDB
    Markdown -->|file read| Gatsby -->|build-time| GraphQL -->|data| Templates -->|"Static HTML"| Dev
    Dev -->|yarn build| Libraries

    %% Shared Configs to Packages
    CommonConfigs --> Parcel
    CommonConfigs --> ReactUI
    CommonConfigs --> APIServer
    CommonConfigs --> Gatsby
    CommonConfigs --> Libraries

    CIConfigs --> Lint
    CIConfigs --> TypeCheck
    CIConfigs --> TestCI
    CIConfigs --> BuildDeploy

    %% Click Events
    click MonorepoRoot "https://github.com/mike-north/typescript-courses/blob/main/.yarnrc.yml"
    click Plugins "https://github.com/mike-north/typescript-courses/blob/main/.yarn/plugins/@yarnpkg/plugin-typescript.cjs"
    click Plugins "https://github.com/mike-north/typescript-courses/blob/main/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs"
    click CommonConfigs "https://github.com/mike-north/typescript-courses/blob/main/tsconfig.json"
    click CommonConfigs "https://github.com/mike-north/typescript-courses/blob/main/.eslintrc.js"
    click CommonConfigs "https://github.com/mike-north/typescript-courses/blob/main/.prettierrc"
    click CommonConfigs "https://github.com/mike-north/typescript-courses/blob/main/.markdownlint.jsonc"
    click CIConfigs "https://github.com/mike-north/typescript-courses/blob/main/.github/workflows/ci-website.yml"
    click CIConfigs "https://github.com/mike-north/typescript-courses/blob/main/.github/workflows/nightly-compatibility.yml"
    click CIConfigs "https://github.com/mike-north/typescript-courses/blob/main/.github/codeql.yml"
    click Parcel "https://github.com/mike-north/typescript-courses/blob/main/packages/chat/.parcelrc"
    click ReactUI "https://github.com/mike-north/typescript-courses/blob/main/packages/chat/src/ui/App.jsx"
    click ReactUI "https://github.com/mike-north/typescript-courses/tree/main/packages/chat/src/ui/components/"
    click Tailwind "https://github.com/mike-north/typescript-courses/blob/main/packages/chat/tailwind.config.js"
    click IndexHTML "https://github.com/mike-north/typescript-courses/blob/main/packages/chat/index.html"
    click Assets "https://github.com/mike-north/typescript-courses/tree/main/packages/chat/assets/img/"
    click APIServer "https://github.com/mike-north/typescript-courses/blob/main/packages/chat/server/api-server.mjs"
    click APIServer "https://github.com/mike-north/typescript-courses/blob/main/packages/chat/server/index.mjs"
    click JSONDB "https://github.com/mike-north/typescript-courses/blob/main/packages/chat/db.json"
    click ChatTests "https://github.com/mike-north/typescript-courses/tree/main/packages/chat/tests/components/"
    click ChatTests "https://github.com/mike-north/typescript-courses/tree/main/packages/chat/tests/utils/"
    click Markdown "https://github.com/mike-north/typescript-courses/tree/main/packages/website/content/blog/"
    click Markdown "https://github.com/mike-north/typescript-courses/blob/main/packages/website/content/courses.yml"
    click Markdown "https://github.com/mike-north/typescript-courses/blob/main/packages/website/content/typescript-jeopardy.yml"
    click Gatsby "https://github.com/mike-north/typescript-courses/blob/main/packages/website/gatsby-config.js"
    click Gatsby "https://github.com/mike-north/typescript-courses/blob/main/packages/website/gatsby-node.js"
    click Gatsby "https://github.com/mike-north/typescript-courses/blob/main/packages/website/gatsby-browser.js"
    click WebsiteTests "https://github.com/mike-north/typescript-courses/blob/main/packages/website/jest-preprocess.js"
    click Templates "https://github.com/mike-north/typescript-courses/tree/main/packages/website/src/templates/"
    click Templates "https://github.com/mike-north/typescript-courses/tree/main/packages/website/src/components/"
    click WebsiteTests "https://github.com/mike-north/typescript-courses/tree/main/packages/website/src/components/__tests__/"
    click WebsiteTests "https://github.com/mike-north/typescript-courses/tree/main/packages/website/cypress/e2e/"
    click WebsiteTests "https://github.com/mike-north/typescript-courses/blob/main/packages/website/cypress.config.ts"
    click Libraries "https://github.com/mike-north/typescript-courses/tree/main/packages/hello-ts/"
    click Libraries "https://github.com/mike-north/typescript-courses/tree/main/packages/http-error/"
    click Libraries "https://github.com/mike-north/typescript-courses/tree/main/packages/notes-enterprise-ts-v2/"
    click Libraries "https://github.com/mike-north/typescript-courses/tree/main/packages/notes-intermediate-ts-v2/"
    click Libraries "https://github.com/mike-north/typescript-courses/tree/main/packages/notes-ts-fundamentals-v4/"
    click Libraries "https://github.com/mike-north/typescript-courses/tree/main/packages/welcome-to-ts/"
    click MonorepoRoot "https://github.com/mike-north/typescript-courses/blob/main/package.json"
    click MonorepoRoot "https://github.com/mike-north/typescript-courses/blob/main/README.md"

    %% Styles
    classDef actor fill:#f9f,stroke:#333,stroke-width:1px
    classDef ci fill:#ffa,stroke:#333,stroke-width:1px
    classDef tool fill:#bbf,stroke:#333,stroke-width:1px
    classDef config fill:#ddd,stroke:#333,stroke-width:1px
    classDef build fill:#bfc,stroke:#333,stroke-width:1px
    classDef runtime fill:#8cf,stroke:#333,stroke-width:1px
    classDef data fill:#ffeb99,stroke:#333,stroke-width:1px
    classDef test fill:#fcc,stroke:#333,stroke-width:1px
    classDef library fill:#ccc,stroke:#333,stroke-width:1px
```
