# viandwi24/blockchain-simulation architecture

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

- Interactive diagram: https://gitdiagram.com/viandwi24/blockchain-simulation
- Repository: https://github.com/viandwi24/blockchain-simulation

## Overview

##### Project type and purpose
- This is a front-end-only, static-site application (no backend server) built with Nuxt.js/Vue.js.
- It simulates blockchain mechanics (blocks, transactions, proof-of-work, wallets) entirely in the browser for educational/demo purposes.
- All business logic lives in JavaScript modules under `/lib`; the UI is composed of Vue pages/components; it’s packaged and deployed as a static site (e.g., GitHub Pages in `/docs`).

##### File structure
- Top-level:
- nuxt.config.js, package.json, jsconfig.json, tailwind.config.js — project configuration
- assets/: global SCSS and images (source for styling and media)
- components/: reusable Vue components (Blocks, Transaction, Wallets, etc.)
- layouts/: Vue layouts (default.vue)
- pages/: Vue pages (index.vue) — entry point of the app
- store/: Vuex store (state management)
- plugins/: Nuxt plugins (auto-import or global components)
- api/composable/: composable functions (e.g., tour, lang) for UI logic
- lib/: core blockchain logic (block.js, transaction.js, blockchain.js, signature.js)
- docs/: generated static output (/_nuxt files, index.html) for hosting
- Notice the MVVM-like separation: Vue components/views ↔ Vuex store ↔ business logic modules

##### README for additional insights
- Describes the demo, shows how to use the `/lib` modules programmatically.
- No server API calls—everything executes in the browser.
- Tech stack: Node.js build, Nuxt/Vue.js front end, TailwindCSS/SCSS styling, Lottie animation.

##### Detailed capture of architectural elements
- How pages import components and composables
- Plugins (component auto-import) as part of the bootstrap layer
- Global styles (Tailwind/SCSS) feeding into component styling
- Major configuration files (nuxt.config.js, tailwind.config.js) in the build section

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Client Browser"]:::external

    subgraph "UI Layer"
        pages["pages/index.vue"]:::ui
        layout["layouts/default.vue"]:::ui
        subgraph "Components"
            blocks["Blocks.vue"]:::ui
            transaction["Transaction.vue"]:::ui
            wallets["Wallets.vue"]:::ui
            loader["Loader.vue"]:::ui
            logComp["Log.vue"]:::ui
            menu["Menu.vue"]:::ui
            navbar["Navbar.vue"]:::ui
            pending["Pending.vue"]:::ui
            setting["Setting.vue"]:::ui
            button["Button.vue"]:::ui
        end
    end

    subgraph "Composable Helpers"
        lang["api/composable/lang.js"]:::ui
        tour["api/composable/tour.js"]:::ui
    end

    store["store/index.js\n(Vuex Store)"]:::state

    subgraph "Business Logic (lib)"
        block["lib/block.js"]:::logic
        transactionLogic["lib/transaction.js"]:::logic
        blockchain["lib/blockchain.js"]:::logic
        signature["lib/signature.js"]:::logic
        logLogic["lib/log.js"]:::logic
        example["lib/example.js"]:::logic
    end

    subgraph "Assets"
        scss["assets/scss/"]:::asset
        images["assets/img/"]:::asset
    end

    static["static/"]:::asset

    subgraph "Build & Config"
        nuxtConfig["nuxt.config.js"]:::build
        pkg["package.json"]:::build
        tailwind["tailwind.config.js"]:::build
        jsconfig["jsconfig.json"]:::build
        plugins["plugins/component.js"]:::build
    end

    docs["docs/"]:::host
    host["Static Web Host"]:::host

    %% Runtime interactions
    Browser -->|loads| pages
    pages -->|uses layout| layout
    layout -->|renders| blocks
    layout -->|renders| transaction
    layout -->|renders| wallets
    layout -->|renders| loader
    layout -->|renders| logComp
    layout -->|renders| menu
    layout -->|renders| navbar
    layout -->|renders| pending
    layout -->|renders| setting
    layout -->|renders| button
    blocks -->|dispatch| store
    transaction -->|dispatch| store
    wallets -->|dispatch| store
    store -->|calls| block
    store -->|calls| transactionLogic
    store -->|calls| blockchain
    store -->|calls| signature
    store -->|calls| logLogic
    store -->|calls| example
    block -->|updates| store
    transactionLogic -->|updates| store
    blockchain -->|updates| store
    signature -->|verifies| store
    logLogic -->|logs| store
    blocks -->|injects| lang
    blocks -->|injects| tour

    plugins -->|bootstraps| blocks

    scss -->|styles| blocks
    images -->|assets| blocks

    %% Build & Deployment
    nuxtConfig -->|configures| pkg
    pkg -->|builds| docs
    tailwind -->|styles| docs
    jsconfig -->|aliases| docs
    static -->|copied to| docs
    plugins -->|included in| docs
    docs -->|served by| host
    host -->|delivers| Browser

    %% Click Events
    click docs "https://github.com/viandwi24/blockchain-simulation/tree/main/docs/"
    click nuxtConfig "https://github.com/viandwi24/blockchain-simulation/blob/main/nuxt.config.js"
    click pkg "https://github.com/viandwi24/blockchain-simulation/blob/main/package.json"
    click tailwind "https://github.com/viandwi24/blockchain-simulation/blob/main/tailwind.config.js"
    click jsconfig "https://github.com/viandwi24/blockchain-simulation/blob/main/jsconfig.json"
    click blocks "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Blocks.vue"
    click transaction "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Transaction.vue"
    click wallets "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Wallets.vue"
    click loader "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Loader.vue"
    click logComp "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Log.vue"
    click menu "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Menu.vue"
    click navbar "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Navbar.vue"
    click pending "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Pending.vue"
    click setting "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Setting.vue"
    click button "https://github.com/viandwi24/blockchain-simulation/blob/main/components/Button.vue"
    click pages "https://github.com/viandwi24/blockchain-simulation/blob/main/pages/index.vue"
    click layout "https://github.com/viandwi24/blockchain-simulation/blob/main/layouts/default.vue"
    click store "https://github.com/viandwi24/blockchain-simulation/blob/main/store/index.js"
    click block "https://github.com/viandwi24/blockchain-simulation/blob/main/lib/block.js"
    click transactionLogic "https://github.com/viandwi24/blockchain-simulation/blob/main/lib/transaction.js"
    click blockchain "https://github.com/viandwi24/blockchain-simulation/blob/main/lib/blockchain.js"
    click signature "https://github.com/viandwi24/blockchain-simulation/blob/main/lib/signature.js"
    click logLogic "https://github.com/viandwi24/blockchain-simulation/blob/main/lib/log.js"
    click example "https://github.com/viandwi24/blockchain-simulation/blob/main/lib/example.js"
    click lang "https://github.com/viandwi24/blockchain-simulation/blob/main/api/composable/lang.js"
    click tour "https://github.com/viandwi24/blockchain-simulation/blob/main/api/composable/tour.js"
    click scss "https://github.com/viandwi24/blockchain-simulation/tree/main/assets/scss/"
    click images "https://github.com/viandwi24/blockchain-simulation/tree/main/assets/img/"
    click static "https://github.com/viandwi24/blockchain-simulation/tree/main/static/"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef state fill:#E4FFE4,stroke:#28a745,color:#28a745;
    classDef logic fill:#E4FFE4,stroke:#28a745,color:#28a745;
    classDef build fill:#FFF5D0,stroke:#d29922,color:#d29922;
    classDef asset fill:#F0F0F0,stroke:#6a737d,color:#6a737d;
    classDef host fill:#F0F0F0,stroke:#6a737d,color:#6a737d;
    classDef external fill:#FFFFFF,stroke:#000000,color:#000000;
```
