# ytw0728/webysics architecture

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

- Interactive diagram: https://gitdiagram.com/ytw0728/webysics
- Repository: https://github.com/ytw0728/webysics

## Overview

##### Main Components

a. Workspace Management Layer
- Nx Monorepo orchestration
- Yarn PnP package management
- Configuration management (_configs package)

b. Application Layer (packages/apps/)
- Individual applications (conway_game_of_life, _example)
- Each application contains:
- TypeScript frontend (src/*.ts)
- Rust backend/WASM integration (src/*.rs)
- Static assets (public/)

c. Shared Modules Layer (packages/modules/)
- Reusable components and libraries
- Mixed TypeScript/Rust implementations

d. Build & Development Infrastructure
- Vite build system
- TypeScript compilation
- Rust/WASM compilation
- Development tooling (eslint, prettier, etc.)

**[Workspace Management Layer]**
- ↓
**[Shared Modules Layer] ←→ [Build Infrastructure]**
- ↓
**[Application Layer]**

##### Key Relationships to Highlight

a. Dependencies:
- Apps depending on shared modules
- Build system interactions with both apps and modules
- Configuration inheritance paths

b. Build Flow:
- TypeScript compilation process
- Rust/WASM compilation process
- Asset processing
- Development server setup

##### Implementation Details

- Tool versions from README (Node, Rust, etc.)
- Build tool chain (Vite, Cargo)
- Development tool integration (ESLint, Prettier, Rustfmt)
- Package management (Yarn PnP)

Top Section:
- Monorepo management tools (Nx, Yarn)
- Global configuration

Middle Section:
- Shared modules and their interactions
- Build system integration

Bottom Section:
- Individual applications
- Runtime environment

Remember to add notes about:
- The potential future conversion to an organization repository
- The specific tool versions being used
- The development workflow
- The build and deployment process

This will create a comprehensive visualization of the project's architecture while maintaining clarity and usefulness for both development and documentation purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph WM["Workspace Management"]
        NX["Nx Config"]:::config
        YARN["Yarn PnP"]:::config
        ROOT["Root Config"]:::config
    end

    subgraph CM["Configuration Management"]
        BC["Base Configs"]:::config
        TC["TypeScript Config"]:::config
        EC["ESLint Config"]:::config
        PC["Prettier Config"]:::config
        VC["Vite Config"]:::config
    end

    subgraph SM["Shared Modules Layer"]
        EM["Example Module"]:::module
        EMT["TypeScript Code"]:::typescript
        EMR["Rust Code"]:::rust
        EM --> EMT
        EM --> EMR
    end

    subgraph BI["Build Infrastructure"]
        VBC["Vite Build Config"]:::build
        VLC["Vite Lib Config"]:::build
        DS["Development Scripts"]:::build
    end

    subgraph AL["Application Layer"]
        EA["Example App"]:::app
        EAT["TypeScript Frontend"]:::typescript
        EAR["Rust Backend"]:::rust
        EAS["Static Assets"]:::static
        EA --> EAT
        EA --> EAR
        EA --> EAS

        CG["Conway Game"]:::app
        CGT["TypeScript Frontend"]:::typescript
        CGS["Static Assets"]:::static
        CG --> CGT
        CG --> CGS
    end

    WM --> CM
    CM --> SM
    CM --> AL
    SM --> AL
    BI --> SM
    BI --> AL

    classDef config fill:#9370DB
    classDef module fill:#4169E1
    classDef typescript fill:#3178C6
    classDef rust fill:#DEA584
    classDef build fill:#32CD32
    classDef app fill:#4169E1
    classDef static fill:#A9A9A9

    click NX "https://github.com/ytw0728/webysics/blob/main/nx.json"
    click YARN "https://github.com/ytw0728/webysics/blob/main/.yarnrc.yml"
    click ROOT "https://github.com/ytw0728/webysics/blob/main/package.json"
    click BC "https://github.com/ytw0728/webysics/tree/main/packages/_configs/"
    click TC "https://github.com/ytw0728/webysics/blob/main/packages/_configs/tsconfig/tsconfig.base.json"
    click EC "https://github.com/ytw0728/webysics/tree/main/packages/_configs/eslint/"
    click PC "https://github.com/ytw0728/webysics/tree/main/packages/_configs/prettier/"
    click VC "https://github.com/ytw0728/webysics/tree/main/packages/_configs/vite/"
    click EA "https://github.com/ytw0728/webysics/tree/main/packages/apps/_example/"
    click EAT "https://github.com/ytw0728/webysics/blob/main/packages/apps/_example/src/index.ts"
    click EAR "https://github.com/ytw0728/webysics/blob/main/packages/apps/_example/src/main.rs"
    click EAS "https://github.com/ytw0728/webysics/tree/main/packages/apps/_example/public/"
    click CG "https://github.com/ytw0728/webysics/tree/main/packages/apps/conway_game_of_life/"
    click CGT "https://github.com/ytw0728/webysics/blob/main/packages/apps/conway_game_of_life/src/index.ts"
    click CGS "https://github.com/ytw0728/webysics/tree/main/packages/apps/conway_game_of_life/public/"
    click EM "https://github.com/ytw0728/webysics/tree/main/packages/modules/_example/"
    click EMT "https://github.com/ytw0728/webysics/blob/main/packages/modules/_example/src/index.ts"
    click EMR "https://github.com/ytw0728/webysics/blob/main/packages/modules/_example/src/lib.rs"
    click VBC "https://github.com/ytw0728/webysics/blob/main/packages/_configs/vite/vite.buildConfig.js"
    click VLC "https://github.com/ytw0728/webysics/blob/main/packages/_configs/vite/vite.libConfig.js"
    click DS "https://github.com/ytw0728/webysics/tree/main/scripts/nx/"
```
