# wesbos/javascript30 architecture

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

- Interactive diagram: https://gitdiagram.com/wesbos/javascript30
- Repository: https://github.com/wesbos/javascript30

## Overview

1. This repository is not a single application; it is a curated set of 30 independent mini-projects from the JavaScript30 challenge. Each numbered folder is a self-contained demo with its own HTML/CSS/JS and its own browser runtime boundary.

2. The top-level structure is intentionally repetitive: most exercises include an `index-START.html` and an `index-FINISHED.html` so the same lesson can be viewed as an unfinished scaffold or a completed solution. A few projects also include separate `style.css` and script files when the lesson needs more structure.

3. There is no shared backend, build system, or app shell connecting the lessons. The repository behaves like a static workshop library: open a folder, load the HTML in a browser, and the page runs entirely client-side.

4. The main architectural pattern across the repo is direct DOM manipulation. Event listeners on keyboard, mouse, scroll, click, drag, and form events drive nearly all behavior, with state kept in local JavaScript variables or simple browser storage rather than in a central framework store.

5. Several lessons are browser-API driven and therefore have distinct runtime boundaries:
   - media/audio demos use the `<audio>` and `<video>` elements plus playback controls,
   - canvas and drawing demos use the HTML5 Canvas API,
   - camera, microphone, and speech exercises use `getUserMedia`, speech recognition, or related browser permissions,
   - geolocation uses the browser location API,
   - persistence exercises use `localStorage`.

6. Some folders include extra assets that are part of the feature boundary, not just decoration. Examples include sound files in the Drum Kit, a video file in Custom Video Player and webcam-related audio in Webcam Fun, and third-party helper scripts like `cornify.js` for the secret key-sequence demo.

7. The data flow in most projects is simple and one-way: user input or browser sensor events enter through the DOM/API, JavaScript transforms or routes that input, and the page updates visuals, audio, or text immediately. A few exercises introduce local state that feeds back into rendering, such as timers, checked-item ranges, or persisted preferences.

8. The repo contains multiple “algorithmic” lessons that do not rely on a rich UI. Array/Cardio, sorting, reducing, reference/copying, and time-aggregation exercises are mostly pure JavaScript logic wrapped in minimal HTML output, so they form a separate subsystem from the interactive UI demos.

9. CSS is sometimes a first-class part of the lesson rather than just styling. Several folders demonstrate layout, transitions, sticky behavior, CSS variables, flexbox, or scroll-linked effects, so the visual layer is often an active participant in the architecture instead of a passive skin.

10. The `package.json` files that appear in a few folders indicate lightweight local tooling for browser-based features, not a monorepo build pipeline. Those folders likely need a simple dev server or dependency setup to make permissioned APIs and live media streams work reliably in the browser.

11. The root `readme.md` is mostly documentation and curation. It links out to the challenge, community solutions, and alternate implementations, but it does not participate in runtime behavior.

12. For an architecture diagram, the most accurate top-level shape is: a documentation/index layer at the root, then 30 isolated static-demo modules underneath, each composed of HTML entrypoint plus optional CSS, JS, and media assets, all executed directly in the browser and connected only by shared tutorial intent rather than shared code.

Main entry points: [`04 - Array Cardio Day 1/index-FINISHED.html`](https://github.com/wesbos/javascript30/blob/HEAD/04%20-%20Array%20Cardio%20Day%201/index-FINISHED.html) (Array cardio), [`readme.md`](https://github.com/wesbos/javascript30/blob/master/readme.md) (readme), [`02 - JS and CSS Clock/index-FINISHED.html`](https://github.com/wesbos/javascript30/blob/HEAD/02%20-%20JS%20and%20CSS%20Clock/index-FINISHED.html) (Clock & variables), [`24 - Sticky Nav/index-FINISHED.html`](https://github.com/wesbos/javascript30/blob/HEAD/24%20-%20Sticky%20Nav/index-FINISHED.html) (Nav effects)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_docs["Root docs"]
  node_readme["readme<br/>docs<br/>[readme.md]"]
  node_library["Workshop set<br/>static repo"]
end

subgraph group_demos["Interactive demos"]
  node_entrypoints["HTML entrypoints<br/>pattern"]
  node_dom(("DOM events<br/>interaction layer"))
  node_css["CSS behavior<br/>presentation layer"]
  node_clock["Clock & variables<br/>interactive demo"]
  node_nav["Nav effects<br/>scroll UI"]
end

subgraph group_api["Browser APIs"]
  node_drum["Drum Kit<br/>audio demo"]
  node_canvas["Canvas draw<br/>canvas demo"]
  node_video["Video player<br/>media UI<br/>[index.html]"]
  node_webcam["Webcam Fun<br/>camera demo<br/>[index.html]"]
  node_speech["Speech demos<br/>speech api"]
  node_geo["Geolocation<br/>location api"]
  node_storage[("LocalStorage<br/>persistence demo")]
  node_mole["Whack A Mole<br/>game demo"]
end

subgraph group_algo["Algorithmic lessons"]
  node_arrays["Array cardio<br/>js exercises"]
  node_copying["Refs vs copy<br/>js exercise"]
  node_sorting["Sort and reduce<br/>js exercises"]
end

node_readme -->|"curates"| node_library
node_library -->|"organizes"| node_entrypoints
node_entrypoints -->|"drives"| node_dom
node_entrypoints -->|"pairs with"| node_css
node_dom -->|"example"| node_drum
node_dom -->|"example"| node_video
node_dom -->|"example"| node_mole
node_css -->|"example"| node_clock
node_css -->|"example"| node_nav
node_library -->|"includes"| node_canvas
node_library -->|"includes"| node_webcam
node_library -->|"includes"| node_speech
node_library -->|"includes"| node_geo
node_library -->|"includes"| node_storage
node_library -->|"includes"| node_arrays
node_arrays -->|"adjacent"| node_copying
node_arrays -->|"adjacent"| node_sorting

click node_readme "https://github.com/wesbos/javascript30/blob/master/readme.md"
click node_drum "https://github.com/wesbos/javascript30/blob/master/01 - JavaScript Drum Kit/index-FINISHED.html"
click node_canvas "https://github.com/wesbos/javascript30/blob/master/08 - Fun with HTML5 Canvas/index-FINISHED.html"
click node_video "https://github.com/wesbos/javascript30/blob/master/11 - Custom Video Player/index.html"
click node_webcam "https://github.com/wesbos/javascript30/blob/master/19 - Webcam Fun/index.html"
click node_speech "https://github.com/wesbos/javascript30/blob/master/20 - Speech Detection/index-FINISHED.html"
click node_geo "https://github.com/wesbos/javascript30/blob/master/21 - Geolocation/index-FINISHED.html"
click node_storage "https://github.com/wesbos/javascript30/blob/master/15 - LocalStorage/index-FINISHED.html"
click node_mole "https://github.com/wesbos/javascript30/blob/master/30 - Whack A Mole/index-FINISHED.html"
click node_arrays "https://github.com/wesbos/javascript30/blob/master/04 - Array Cardio Day 1/index-FINISHED.html"
click node_copying "https://github.com/wesbos/javascript30/blob/master/14 - JavaScript References VS Copying/index-FINISHED.html"
click node_sorting "https://github.com/wesbos/javascript30/blob/master/17 - Sort Without Articles/index-FINISHED.html"
click node_clock "https://github.com/wesbos/javascript30/blob/master/02 - JS and CSS Clock/index-FINISHED.html"
click node_nav "https://github.com/wesbos/javascript30/blob/master/24 - Sticky Nav/index-FINISHED.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_readme,node_library toneBlue
class node_entrypoints,node_dom,node_css,node_clock,node_nav toneAmber
class node_drum,node_canvas,node_video,node_webcam,node_speech,node_geo,node_storage,node_mole toneMint
class node_arrays,node_copying,node_sorting toneRose
```

## Components

### Root docs

Documentation and curation at the repository root.

- [readme](https://github.com/wesbos/javascript30/blob/master/readme.md): docs · Curates the challenge and links the workshop together, but does not participate in runtime behavior. · `readme.md`
- **Workshop set**: static repo · A curated library of 30 isolated browser demos with no shared app shell or backend.

### Interactive demos

Static browser mini-projects built around DOM events and visual interaction.

- **HTML entrypoints**: pattern · Each lesson is loaded directly from a folder via index HTML, usually with START and FINISHED variants.
- **DOM events**: interaction layer · Direct event listeners and local state drive most lessons: keyboard, mouse, click, scroll, drag, and forms.
- **CSS behavior**: presentation layer · In several lessons CSS is active behavior, not just styling: layout, transitions, sticky positioning, and variables.
- [Clock & variables](https://github.com/wesbos/javascript30/blob/HEAD/02%20-%20JS%20and%20CSS%20Clock/index-FINISHED.html): interactive demo · Representative lessons where CSS variables and time-based DOM updates coordinate a live UI. · `02 - JS and CSS Clock/index-FINISHED.html`
- [Nav effects](https://github.com/wesbos/javascript30/blob/HEAD/24%20-%20Sticky%20Nav/index-FINISHED.html): scroll UI · Representative lessons for sticky navigation, link highlighting, and scroll-linked behavior. · `24 - Sticky Nav/index-FINISHED.html`

### Browser APIs

Lessons centered on media, sensors, speech, location, canvas, and storage APIs.

- [Drum Kit](https://github.com/wesbos/javascript30/blob/HEAD/01%20-%20JavaScript%20Drum%20Kit/index-FINISHED.html): audio demo · Keyboard-driven playback mapped to sound assets in a self-contained demo. · `01 - JavaScript Drum Kit/index-FINISHED.html`
- [Canvas draw](https://github.com/wesbos/javascript30/blob/HEAD/08%20-%20Fun%20with%20HTML5%20Canvas/index-FINISHED.html): canvas demo · HTML5 Canvas interactions for drawing and visual feedback. · `08 - Fun with HTML5 Canvas/index-FINISHED.html`
- [Video player](https://github.com/wesbos/javascript30/blob/HEAD/11%20-%20Custom%20Video%20Player/index.html): media UI · Custom playback controls layered over a local video asset. · `11 - Custom Video Player/index.html`
- [Webcam Fun](https://github.com/wesbos/javascript30/blob/HEAD/19%20-%20Webcam%20Fun/index.html): camera demo · Permissioned webcam and media-stream exercise with live capture and effects. · `19 - Webcam Fun/index.html`
- [Speech demos](https://github.com/wesbos/javascript30/blob/HEAD/20%20-%20Speech%20Detection/index-FINISHED.html): speech api · Speech detection and synthesis lessons built on browser speech APIs. · `20 - Speech Detection/index-FINISHED.html`
- [Geolocation](https://github.com/wesbos/javascript30/blob/HEAD/21%20-%20Geolocation/index-FINISHED.html): location api · Browser location API lesson for sensor-driven state and display. · `21 - Geolocation/index-FINISHED.html`
- [LocalStorage](https://github.com/wesbos/javascript30/blob/HEAD/15%20-%20LocalStorage/index-FINISHED.html): persistence demo · Client-side persistence lesson using browser storage to retain state. · `15 - LocalStorage/index-FINISHED.html`
- [Whack A Mole](https://github.com/wesbos/javascript30/blob/HEAD/30%20-%20Whack%20A%20Mole/index-FINISHED.html): game demo · Timer- and state-driven browser game with repeated local interactions. · `30 - Whack A Mole/index-FINISHED.html`

### Algorithmic lessons

JavaScript exercises focused on data transformation and language behavior.

- [Array cardio](https://github.com/wesbos/javascript30/blob/HEAD/04%20-%20Array%20Cardio%20Day%201/index-FINISHED.html): js exercises · Pure JavaScript data manipulation lessons wrapped in minimal HTML output. · `04 - Array Cardio Day 1/index-FINISHED.html`
- [Refs vs copy](https://github.com/wesbos/javascript30/blob/HEAD/14%20-%20JavaScript%20References%20VS%20Copying/index-FINISHED.html): js exercise · Language-behavior lesson focused on object and array reference semantics. · `14 - JavaScript References VS Copying/index-FINISHED.html`
- [Sort and reduce](https://github.com/wesbos/javascript30/blob/HEAD/17%20-%20Sort%20Without%20Articles/index-FINISHED.html): js exercises · Algorithmic lessons on sorting strings and aggregating time values. · `17 - Sort Without Articles/index-FINISHED.html`

## Connections

- readme → Workshop set: curates · The root documentation frames the repository as a workshop collection.
- Workshop set → HTML entrypoints: organizes · Each numbered folder exposes direct browser entrypoints, usually START and FINISHED variants.
- HTML entrypoints → DOM events: drives · Most demos attach event listeners and update the page in response to user input.
- HTML entrypoints → CSS behavior: pairs with · Some lessons use CSS as part of the mechanism, not just the skin.
- DOM events → Drum Kit: example · Keyboard events trigger audio playback.
- DOM events → Video player: example · Input handling controls media playback and UI state.
- DOM events → Whack A Mole: example · Clicks and timers drive game flow.
- CSS behavior → Clock & variables: example · CSS variables and live DOM updates combine for the clock lesson.
- CSS behavior → Nav effects: example · Sticky and scroll-linked behavior is central to the navigation lessons.
- Workshop set → Canvas draw: includes · Canvas-based drawing is one of the distinct browser-API boundaries in the set.
- Workshop set → Webcam Fun: includes · Some lessons require permissioned media streams and live capture.
- Workshop set → Speech demos: includes · Speech recognition and synthesis form another browser-API subsystem.
- Workshop set → Geolocation: includes · Location-based exercises depend on the browser geolocation API.
- Workshop set → LocalStorage: includes · Persistence lessons keep state in localStorage.
- Workshop set → Array cardio: includes · Several lessons are mostly algorithmic JavaScript with minimal UI.
- Array cardio → Refs vs copy: adjacent · Reference/copying is part of the same language-behavior exercise cluster.
- Array cardio → Sort and reduce: adjacent · Sorting and time aggregation belong to the pure-data lesson cluster.
