# stevenhao/set architecture

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

- Interactive diagram: https://gitdiagram.com/stevenhao/set
- Repository: https://github.com/stevenhao/set

## Overview

##### Project type and purpose
- This is a single‑page, browser‑based implementation of the Set card game.
- There is no dynamic backend or database—everything lives in the `public/` directory and is served as static assets over HTTP(S).

##### File structure
- Top‑level files:
- README.md – project description, build and deploy instructions
- deploy.sh, dev.sh – scripts to push static files to a server via rsync
- `public/` directory (the entire frontend):
- index.html – application entry point
- index.css – global stylesheet
- *.coffee – game logic split into model.coffee, view.coffee, controller.coffee (an MVC‑inspired layout)
- powerset.html, superset.html, hiddenset.html – variant entry points for different game modes

##### README for additional insights
- Describes a build step: compile `.coffee` → `.js` using the CoffeeScript compiler
- Deployment is done by running the shell scripts, which use rsync to sync the entire project to a remote `set/` directory on the server

##### Elements
- Clear component labels: Developer, Build, Deploy Scripts, Static Server, Browser
- Code → Build → Artifacts → Deploy → Server → Browser
- Within the browser: user input → Controller → Model update → View rendering
- Rectangles for system components (Build Server, Static Server, Browser)

##### Final advice
- Be very detailed: capture every stage from development to user interaction
- Don’t overthink—since it’s a static site, simply enumerate the components (IDE, compiler, scripts, server, browser) and show how they connect

## Diagram (Mermaid)

```mermaid
graph TB
    %% Developer Workstation
    Dev["Developer Workstation\n(IDE + Git)"]:::developer
    README["README.md"]:::artifact

    %% Build Process
    subgraph "Build"
        Compiler["CoffeeScript Compiler\n(coffee -c)"]:::build
        CoffeeSrc[".coffee Sources"]:::coffee
        JSArtifacts["Compiled JavaScript\n(artifacts)"]:::artifact
        CSS["Global Stylesheet"]:::css
        HTMLFiles["HTML Entry Points"]:::html
    end

    %% Deployment Scripts
    subgraph "Deployment Scripts"
        DevScript["dev.sh"]:::script
        ProdScript["deploy.sh"]:::script
    end

    %% Static Server
    Server["Static Web Server\n(nginx/Apache/GitHub Pages)"]:::server

    %% Browser & MVC
    subgraph "Browser"
        User["User Input"]:::browser
        Controller["Controller"]:::coffee
        Model["Model"]:::coffee
        View["View"]:::coffee
        subgraph "Supplemental Modules"
            Variants["variants.js"]:::js
            Draw["draw.js"]:::js
            Header["header.js"]:::js
        end
        User -->|interacts| Controller
        Controller -->|updates| Model
        Model -->|state data| View
        View -->|renders DOM| User
        Controller -->|uses| Variants
        Controller -->|uses| Draw
        Controller -->|uses| Header
    end

    %% Flows
    Dev -->|edits| CoffeeSrc
    Dev -->|edits| CSS
    Dev -->|edits| HTMLFiles
    Dev -->|edits| README
    CoffeeSrc -.->|compile| Compiler
    CSS -->|bundled| Server
    HTMLFiles -->|bundled| Server
    Compiler -->| outputs| JSArtifacts
    JSArtifacts -->|bundled| Server
    DevScript -->|rsync sync| Server
    ProdScript -->|rsync deploy| Server
    Server -->|serves HTTP| Browser

    %% Click Events
    click README "https://github.com/stevenhao/set/blob/master/README.md"
    click CoffeeSrc "https://github.com/stevenhao/set/blob/master/public/model.coffee"
    click CoffeeSrc "https://github.com/stevenhao/set/blob/master/public/view.coffee"
    click CoffeeSrc "https://github.com/stevenhao/set/blob/master/public/controller.coffee"
    click CSS "https://github.com/stevenhao/set/blob/master/public/index.css"
    click HTMLFiles "https://github.com/stevenhao/set/blob/master/public/index.html"
    click HTMLFiles "https://github.com/stevenhao/set/blob/master/public/hiddenset.html"
    click HTMLFiles "https://github.com/stevenhao/set/blob/master/public/powerset.html"
    click HTMLFiles "https://github.com/stevenhao/set/blob/master/public/superset.html"
    click Variants "https://github.com/stevenhao/set/blob/master/public/variants.js"
    click Draw "https://github.com/stevenhao/set/blob/master/public/draw.js"
    click Header "https://github.com/stevenhao/set/blob/master/public/header.js"
    click DevScript "https://github.com/stevenhao/set/blob/master/dev.sh"
    click ProdScript "https://github.com/stevenhao/set/blob/master/deploy.sh"

    %% Styles
    classDef developer fill:#f9f,stroke:#333,stroke-width:1px
    classDef build fill:#bbf,stroke:#333,stroke-width:1px
    classDef script fill:#fbf,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef server fill:#bfb,stroke:#333,stroke-width:1px
    classDef browser fill:#ffb,stroke:#333,stroke-width:1px
    classDef coffee fill:#ffa,stroke:#333,stroke-width:1px
    classDef js fill:#aff,stroke:#333,stroke-width:1px
    classDef html fill:#faf,stroke:#333,stroke-width:1px
    classDef css fill:#aaf,stroke:#333,stroke-width:1px
    classDef artifact fill:#eee,stroke:#333,stroke-width:1px
```
