# tropicbird/mcp-demo-cursor architecture

> Architecture diagram of the GitHub repository tropicbird/mcp-demo-cursor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tropicbird/mcp-demo-cursor
- Repository: https://github.com/tropicbird/mcp-demo-cursor

## Overview

##### Main Components
- Game UI & Entry Point: Represented by index.html. This is where users access the game and start the interaction.
- Game Logic & Interaction: Found in apple/js/main.js. This component contains the scripts that handle user input (tap/click) and game mechanics (tracking rotations, time limits).
- 3D Assets: The apple folder holds the 3D model files such as apple.gltf and apple.bin. These files are loaded and rendered using three.js.
- 3D Engine Library: The lib directory contains the three.js library, along with multiple example modules (e.g., OrbitControls, GLTFLoader, BufferGeometryUtils) that enable loading the 3D assets, camera controls, and scene management.
- Development/Automation Configurations: The .cursor directory includes rules (my-github-rule.mdc and my-slack-rule.mdc), which are used to automate GitHub pull request notifications to Slack. These components are part of the continuous integration or notifications pipeline.

##### Relationships and Interactions
- The UI (index.html) initializes the game and manages the overall layout and responsiveness for mobile devices.
- When the game starts, the JavaScript in apple/js/main.js is executed. This script calls functions from the three.js library (loaded from lib/three) to set up the 3D scene.
- The game logic uses three.js components (for instance, OrbitControls and GLTFLoader) to load the apple assets and to capture user input (clicks or taps) that cause the apple to rotate.
- The animation and rotation count logic run entirely on the client side.
- Parallelly, for development and deployment, the .cursor rules are used to automate handling issues and notifying via Slack once pull requests are made on GitHub.

##### Architectural Patterns & Design Principles
- Frontend-Centric Architecture: This project is structured as a monolithic client-side application with clear separation of concerns between UI, game logic, and rendering.
- Modularization: Although it is a simple game, modules are separated into directories (apple for assets and game logic, lib for external libraries) which indicates an effort toward clean organization.
- Integration of Third-Party Libraries: The extensive use of three.js and its helper modules is central to the project’s interactive 3D rendering.
- Development Workflow Automation: The inclusion of .cursor rules shows an aspect of DevOps, where notifications and issue tracking are built into the development process.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "りんご回転ゲーム Application"
        %% Game Runtime Components
        subgraph "Game Runtime"
            UI["index.html"]:::core
            GameLogic["apple/js/main.js"]:::core
            UI -->|"triggers"| GameLogic

            subgraph "3D Rendering Engine"
                threejs["three.js Library"]:::core
                orbit["OrbitControls"]:::core
                gltfLoader["GLTFLoader"]:::core
                buffer["BufferGeometryUtils"]:::core
                threejs -->|"controls"| orbit
                threejs -->|"loads"| gltfLoader
                threejs -->|"utilizes"| buffer
            end
            GameLogic -->|"calls"| threejs

            subgraph "3D Assets"
                assetGltf["apple.gltf"]:::core
                assetBin["apple.bin"]:::core
            end
            threejs -->|"renders"| assetGltf
            threejs -->|"renders"| assetBin
        end

        %% DevOps Automation Components
        subgraph "DevOps Automation"
            GitHub["GitHub Rule"]:::devops
            Slack["Slack Rule"]:::devops
            GitHub -->|"notifies"| Slack
        end
    end

    %% Click Events
    click UI "https://github.com/tropicbird/mcp-demo-cursor/blob/main/index.html"
    click GameLogic "https://github.com/tropicbird/mcp-demo-cursor/blob/main/apple/js/main.js"
    click assetGltf "https://github.com/tropicbird/mcp-demo-cursor/blob/main/apple/apple.gltf"
    click assetBin "https://github.com/tropicbird/mcp-demo-cursor/blob/main/apple/apple.bin"
    click threejs "https://github.com/tropicbird/mcp-demo-cursor/tree/main/lib/three"
    click orbit "https://github.com/tropicbird/mcp-demo-cursor/blob/main/lib/three/examples/jsm/controls/OrbitControls.js"
    click gltfLoader "https://github.com/tropicbird/mcp-demo-cursor/blob/main/lib/three/examples/jsm/loaders/GLTFLoader.js"
    click buffer "https://github.com/tropicbird/mcp-demo-cursor/blob/main/lib/three/examples/jsm/utils/BufferGeometryUtils.js"
    click GitHub "https://github.com/tropicbird/mcp-demo-cursor/blob/main/.cursor/rules/my-github-rule.mdc"
    click Slack "https://github.com/tropicbird/mcp-demo-cursor/blob/main/.cursor/rules/my-slack-rule.mdc"

    %% Styles
    classDef core fill:#A3E4D7,stroke:#1E8449,stroke-width:2px;
    classDef devops fill:#F9E79F,stroke:#D4AC0D,stroke-width:2px;
```
