# tsheylock/cm1 architecture

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

- Interactive diagram: https://gitdiagram.com/tsheylock/cm1
- Repository: https://github.com/tsheylock/cm1

## Overview

##### Project type and purpose
- This is a single-page, front-end React/TypeScript application built with Vite, Tailwind CSS and PostCSS.
- The app renders a metaverse scene (MetaverseScene.tsx), mirrors the user’s webcam feed (WebcamMirror.tsx), and integrates with Web3 (useWeb3.ts) for blockchain interactions.

##### File structure
- Top-level:
- index.html: the SPA entry point
- package.json / lock: dependencies and scripts
- vite.config.ts: bundler configuration
- tailwind.config.js & postcss.config.js: CSS tooling
- tsconfig*.json: TypeScript setups
- src/
- main.tsx: bootstraps React
- App.tsx: root component and router (if any)
- components/: UI pieces (MetaverseScene, WebcamMirror)
- hooks/: custom logic (useWeb3)
- index.css: global styles
- .bolt/, eslint.config.js, .gitignore: developer tooling

##### README
- Minimal: points to a StackBlitz editor.
- Confirms front-end focus and use of modern JS/TS tooling.

##### Main components and interactions
a. Browser / Client
– Hosts the SPA, requests index.html, runs bundled JS/CSS.
b. Vite Dev Server / Build Pipeline
– Transpiles TSX/TS, processes Tailwind-PostCSS, serves assets.
c. React Application
– App.tsx orchestrates:
- MetaverseScene.tsx: WebGL/three.js or similar to render 3D content
- WebcamMirror.tsx: accesses webcam via browser APIs
- useWeb3.ts: connects to Ethereum wallet (e.g., MetaMask) and RPC node
d. External Blockchain Service
– A remote Ethereum node or provider (Infura, Alchemy, etc.)
e. (Optional) Static Hosting / CDN
– Deployed output: static files on Netlify, Vercel, GitHub Pages

##### Architectural patterns and design principles
- Component-based UI (React)
- Hook-based separation of concerns (useWeb3 abstracts all blockchain logic)
- CSS utility-first via Tailwind, PostCSS pipeline
- Modern bundler (Vite) for fast HMR & production builds

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build Tooling Layer
    subgraph "Build Tooling"
        VITE["Vite Dev Server / Build Pipeline"]:::build
        TAILWIND["Tailwind CSS Processor"]:::build
        POSTCSS["PostCSS Processor"]:::build
        PKG["Dependency & Script Management (package.json)"]:::build
        BOLT["Developer Tooling Config (.bolt/config.json)"]:::build
        README["README.md"]:::docs
    end

    %% Client App Layer
    subgraph "Client App"
        INDEX["SPA Entry Point (index.html)"]:::client
        MAIN["React Bootstrap (src/main.tsx)"]:::client
        APP["Root Component and Router (src/App.tsx)"]:::client
        GLOBALCSS["Global Styles (src/index.css)"]:::client
        TSENV["TypeScript Declarations (src/vite-env.d.ts)"]:::client
    end

    %% UI Components & Logic Layer
    subgraph "UI Components & Logic"
        SCENE["Metaverse 3D Scene Component (src/components/MetaverseScene.tsx)"]:::component
        WEBCAM["Webcam Mirror Component (src/components/WebcamMirror.tsx)"]:::component
        WEB3["Web3 Integration Hook (src/hooks/useWeb3.ts)"]:::component
    end

    %% External Services Layer
    subgraph "External Services"
        ETH["Ethereum Node / RPC Provider"]:::external
        CDN["Static Hosting / CDN"]:::external
    end

    %% Connections
    PKG -->|"provides deps"| VITE
    TAILWIND -->|"CSS tooling"| VITE
    POSTCSS -->|"PostCSS pipeline"| VITE
    VITE -->|"serves files"| INDEX
    CDN -->|"hosts static files"| INDEX

    INDEX -->|"HTTP GET"| MAIN
    MAIN -->|"renders"| APP
    MAIN -->|"imports"| GLOBALCSS
    MAIN -->|"loads types"| TSENV

    APP -->|"mounts"| SCENE
    APP -->|"mounts"| WEBCAM
    APP -->|"uses"| WEB3
    WEB3 -->|"Web3 RPC call"| ETH
    ETH -->|"RPC response"| WEB3

    %% Click Events
    click VITE "https://github.com/tsheylock/cm1/blob/main/vite.config.ts"
    click TAILWIND "https://github.com/tsheylock/cm1/blob/main/tailwind.config.js"
    click POSTCSS "https://github.com/tsheylock/cm1/blob/main/postcss.config.js"
    click PKG "https://github.com/tsheylock/cm1/blob/main/package.json"
    click INDEX "https://github.com/tsheylock/cm1/blob/main/index.html"
    click MAIN "https://github.com/tsheylock/cm1/blob/main/src/main.tsx"
    click APP "https://github.com/tsheylock/cm1/blob/main/src/App.tsx"
    click GLOBALCSS "https://github.com/tsheylock/cm1/blob/main/src/index.css"
    click TSENV "https://github.com/tsheylock/cm1/blob/main/src/vite-env.d.ts"
    click SCENE "https://github.com/tsheylock/cm1/blob/main/src/components/MetaverseScene.tsx"
    click WEBCAM "https://github.com/tsheylock/cm1/blob/main/src/components/WebcamMirror.tsx"
    click WEB3 "https://github.com/tsheylock/cm1/blob/main/src/hooks/useWeb3.ts"
    click BOLT "https://github.com/tsheylock/cm1/blob/main/.bolt/config.json"
    click README "https://github.com/tsheylock/cm1/blob/main/README.md"

    %% Styles
    classDef build fill:#e0e0e0,stroke:#333,stroke-width:1px
    classDef client fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef component fill:#ffe0b2,stroke:#333,stroke-width:1px
    classDef external fill:#c8e6c9,stroke:#333,stroke-width:1px
    classDef docs fill:#f5f5f5,stroke:#333,stroke-width:1px
```
