# guillex7/wasm2010 architecture

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

- Interactive diagram: https://gitdiagram.com/guillex7/wasm2010
- Repository: https://github.com/guillex7/wasm2010

## Overview

- User Interface: Represent the front end, built primarily using Vue.js components. In the file tree you have a clear separation with components located under src/components (with dedicated subdirectories for the assembler and emulator interfaces).
- State Management: Emphasize the roles of the Vue “stores” (e.g., assembler.ts, emulator.ts, global.ts) which manage the application state.
- Core WebAssembly Engine: Highlight the WASM module development contained in src/core/wasm. Note that this part is implemented in C (with its own CMakeLists.txt and Makefile), making it independent from the UI, and is responsible for the low-level execution and simulation.
- Utility and Core Logic: Include a component for TypeScript business logic in src/core/ts (handling core computation, I/O abstraction, and system logic) which interacts directly with the UI and WebAssembly modules.
- Assets and Styling: Although less critical in terms of architecture, you may show a subsidiary branch to indicate dedicated directories for assets like fonts and styles, ensuring that the UI is well-supported.
- Documentation & Build/Deployment Setup: Optionally mark the presence of Docker, webpack configuration, and other build tools (e.g., Dockerfile, webpack.config.js) as well as the official documentation found in the docs folder.

##### Relationships and interactions
- User actions in the web interface (input via the assembler or emulator panels) trigger state changes managed by the Vue stores.
- The state management layer communicates with the core logic layer (TypeScript modules under src/core/ts), which then delegates tasks to the WASM engine (compiled from the C code in src/core/wasm).
- The WASM engine encapsulates the computational core (assembler and emulator functionality) and sends back execution results, debugging information, or visual signal data to the UI.

##### Architectural patterns and principles
- Frontend MVC/MVVM Pattern: The separation of components (Vue view components, stores for state, and central logic) demonstrates a modular design.
- Layered Architecture: Distinct layers (Presentation/UI, Application Logic, and WASM Engine) should be visible, showcasing a clear separation of responsibilities.
- Integration via WebAssembly: Emphasize the separation of the high-level UI written in JavaScript/TypeScript and the low-level performance-critical WASM module written in C. This integration is a key design principle ensuring portability and reusability.

##### Technologies, frameworks, and libraries
- Frontend Framework: Vue.js (embedding components like App.vue, WasmAssembler.vue, and WasmEmulator.vue).
- State Management: Vue stores, as coded in several files in the src/stores directory.
- WebAssembly: WASM modules built through C (using CMake and Makefile) found in src/core/wasm.
- Tooling: Webpack for bundling (webpack.config.js) and Docker for containerized builds (Dockerfile).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend/UI Layer
    subgraph "Frontend/UI"
        assemblerUI["Vue UI – Assembler"]:::ui
        emulatorUI["Vue UI – Emulator"]:::ui
    end

    %% Application Logic Layer
    subgraph "Application Logic"
        stateMgmt["State Management (Vue Stores)"]:::app
        coreLogic["Core Business Logic (TS Modules)"]:::app
    end

    %% Backend Layer
    subgraph "Backend"
        wasmEngine["WebAssembly Engine (C/WASM Module)"]:::backend
    end

    %% Support Components
    subgraph "Support"
        assets["Assets and Styling"]:::support
        subgraph "Documentation & Build/Deployment Setup"
            docs["Documentation"]:::support
            docker["Dockerfile"]:::support
            webpack["webpack.config.js"]:::support
        end
    end

    %% Data Flow Arrows
    assemblerUI -->|"triggersState"| stateMgmt
    emulatorUI  -->|"triggersState"| stateMgmt
    stateMgmt   -->|"callsLogic"| coreLogic
    coreLogic   -->|"delegatesTo"| wasmEngine
    wasmEngine  -->|"feedback"| coreLogic
    coreLogic   -->|"updatesState"| stateMgmt
    stateMgmt   -->|"notifiesUI"| assemblerUI
    stateMgmt   -->|"notifiesUI"| emulatorUI

    %% Click Events
    click assemblerUI "https://github.com/guillex7/wasm2010/blob/master/src/components/assembler/WasmAssembler.vue"
    click emulatorUI "https://github.com/guillex7/wasm2010/blob/master/src/components/emulator/WasmEmulator.vue"
    click stateMgmt "https://github.com/guillex7/wasm2010/tree/master/src/stores"
    click coreLogic "https://github.com/guillex7/wasm2010/tree/master/src/core/ts"
    click wasmEngine "https://github.com/guillex7/wasm2010/tree/master/src/core/wasm"
    click assets "https://github.com/guillex7/wasm2010/tree/master/src/assets"
    click docs "https://github.com/guillex7/wasm2010/tree/master/docs"
    click docker "https://github.com/guillex7/wasm2010/tree/master/Dockerfile"
    click webpack "https://github.com/guillex7/wasm2010/blob/master/webpack.config.js"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef app fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef backend fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef support fill:#fff3cd,stroke:#856404,stroke-width:2px;
```
