# winderton/xplatform architecture

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

- Interactive diagram: https://gitdiagram.com/winderton/xplatform
- Repository: https://github.com/winderton/xplatform

## Overview

##### Project type and purpose
- This “xplatform” repository is a polyglot, monolithic “monorepo” composed of several mini-projects (modules), each illustrating a core CS concept or technology (Serialization, Networking, Blockchain, Event System, Full-stack Web App, etc.). It’s not a single end-to-end application but a collection of independent C++ (and a bit of Java/HTML) executables and libraries, each with its own build rules (CMake or Visual Studio projects).

##### File structure
- Top-level folders each represent a module/app:
- serialization – custom C++ serialization library + tests
- Blockchain – C++ core (Merkle, Ledger, Transaction, Miner), JSON helper, HTTP server/client, GUI resources, static web UI
- client – standalone C++ client CLI
- server – standalone C++ server CLI
- ide – minimal C++ IDE front-end
- renderer – OpenGL renderer + cross-platform Event System (glfw + Win32)
- userland – toy userland executable
- java – single Java Client.java
- .github – CI workflow (cmake.yml)
- vendor & .gitmodules – submodules / third-party libs
- Build scripts: CMakeLists.txt in serialization, Visual Studio project files in most modules, a solution file youtube.sln at root.

##### Key architectural insights from README
- Each module is self-contained and intended for demo/video tutorial.
- There’s a clear separation: libraries (serialization, core algorithms, event system) vs. applications (blockchain node, CLI client/server, IDE, renderer, web app).
- Future modules will plug into similar patterns (compilers, ECS, allocators, etc.).

##### Main components
– Core Libraries:
- Serialization Lib (serialization/include, src, tests)
- JSON Helper (Blockchain/src/json.h, json.hh)
- HTTP Net Lib (Blockchain/src/net: server_http, client_http, utilities)
- Event System Lib (renderer/src/Event System)
– Applications:
- Blockchain Node (core + net + GUI + web)
- CLI Client (client)
- CLI Server (server)
- Minimal IDE (ide)
- Renderer App (renderer with shaders)
- Userland Demo (userland)
- Java Client (java)
– Third-Party/Vendor: any submodules under vendor, and build tools (CMake, premake, spdlog, googletest)
– CI/CD: .github/workflows/cmake.yml

b. Relationships & interactions
– Tests (serialization/tests) depend on Serialization Lib.
– Vendor → Core Libs & Apps (show consumption of external libraries).

c. Architectural patterns & principles
– Modular Monorepo (each module with its own project file)
– Dependency Injection at compile-time (apps link to libs via CMake/VS)
– Layered design inside Blockchain Node: Core (consensus, Merkle, ledger) ← Network ← GUI ← Static Web UI
– Event-driven architecture in Renderer (Event System → Render Loop)

d. Technologies & frameworks
– C++17 (VS projects + CMake)
– Custom libs: serialization, merkleTree
– JSON header-only
– HTTP server/client (lightweight, header-only)
– GLFW + Win32 for Event System
– OpenGL shaders (.vert, .frag) in renderer
– Java (single class)
– Build/test: CMake, Google Test, spdlog, premake

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "xplatform"
        subgraph "Libraries & Utilities"
            SerLib["Serialization Library\n(C++17)"]:::lib
            JSONLib["JSON Helper Library\n(header-only)"]:::lib
            HttpLib["HTTP Network Library\n(header-only)"]:::lib
            EventLib["Event System Library\n(GLFW/Win32)"]:::lib
            CoreChainLib["Core Blockchain Library\n(consensus, merkle, ledger)"]:::lib
            SerTests["Serialization Tests"]:::app
        end

        subgraph "Executables & Demos"
            BlockchainNode["Blockchain Node\nC++/HTTP/GUI/Web"]:::app
            CLIClient["CLI Client\nC++"]:::app
            CLIServer["CLI Server\nC++"]:::app
            IDE["Minimal IDE\nC++"]:::app
            RendererApp["Renderer App\nC++/OpenGL"]:::app
            UserlandDemo["Userland Demo\nC++"]:::app
            JavaClient["Java Client\nJava"]:::app
        end
    end

    Vendor["Vendor / Third-Party"]:::ext
    CICD["CI/CD Workflow"]:::ci

    %% Dependencies
    SerTests -->|"tests link"| SerLib
    BlockchainNode -->|"links to"| CoreChainLib
    BlockchainNode -->|"uses JSON"| JSONLib
    BlockchainNode -->|"uses HTTP"| HttpLib
    BlockchainNode -->|"serializes?"| SerLib
    CLIClient -->|"HTTP call"| HttpLib
    CLIServer -->|"HTTP call"| HttpLib
    IDE -->|"HTTP call"| HttpLib
    RendererApp -->|"event dispatch"| EventLib

    Vendor --> SerLib
    Vendor --> JSONLib
    Vendor --> HttpLib
    Vendor --> EventLib
    Vendor --> CoreChainLib
    Vendor --> BlockchainNode
    Vendor --> CLIClient
    Vendor --> CLIServer
    Vendor --> IDE
    Vendor --> RendererApp
    Vendor --> UserlandDemo
    Vendor --> JavaClient

    CICD --> SerLib
    CICD --> SerTests
    CICD --> JSONLib
    CICD --> HttpLib
    CICD --> EventLib
    CICD --> CoreChainLib
    CICD --> BlockchainNode
    CICD --> CLIClient
    CICD --> CLIServer
    CICD --> IDE
    CICD --> RendererApp
    CICD --> UserlandDemo
    CICD --> JavaClient

    %% Click Events
    click SerLib "https://github.com/winderton/xplatform/tree/master/serialization/include"
    click SerLib "https://github.com/winderton/xplatform/tree/master/serialization/src"
    click SerTests "https://github.com/winderton/xplatform/tree/master/serialization/tests"
    click JSONLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/json.h"
    click JSONLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/json.hh"
    click HttpLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/net/client_http.hpp"
    click HttpLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/net/server_http.hpp"
    click HttpLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/net/status_code.hpp"
    click HttpLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/net/utility.hpp"
    click EventLib "https://github.com/winderton/xplatform/blob/master/renderer/src/Event System/event.h"
    click EventLib "https://github.com/winderton/xplatform/blob/master/renderer/src/Event System/keyboardevent.h"
    click EventLib "https://github.com/winderton/xplatform/blob/master/renderer/src/Event System/mouseevent.h"
    click EventLib "https://github.com/winderton/xplatform/blob/master/renderer/src/Event System/window.h"
    click EventLib "https://github.com/winderton/xplatform/blob/master/renderer/src/Event System/window.cpp"
    click EventLib "https://github.com/winderton/xplatform/blob/master/renderer/src/Event System/windowevent.h"
    click BlockchainNode "https://github.com/winderton/xplatform/blob/master/Blockchain/Blockchain.vcxproj"
    click BlockchainNode "https://github.com/winderton/xplatform/blob/master/Blockchain/src/main.cpp"
    click CLIClient "https://github.com/winderton/xplatform/blob/master/client/client.vcxproj"
    click CLIClient "https://github.com/winderton/xplatform/blob/master/client/src/client.cpp"
    click CLIClient "https://github.com/winderton/xplatform/blob/master/client/src/client.h"
    click CLIClient "https://github.com/winderton/xplatform/blob/master/client/src/main.cpp"
    click CLIServer "https://github.com/winderton/xplatform/blob/master/server/server.vcxproj"
    click CLIServer "https://github.com/winderton/xplatform/blob/master/server/src/server.cpp"
    click CLIServer "https://github.com/winderton/xplatform/blob/master/server/src/server.h"
    click CLIServer "https://github.com/winderton/xplatform/blob/master/server/src/main.cpp"
    click IDE "https://github.com/winderton/xplatform/blob/master/ide/ide.vcxproj"
    click IDE "https://github.com/winderton/xplatform/blob/master/ide/src/main.cpp"
    click RendererApp "https://github.com/winderton/xplatform/blob/master/renderer/renderer.vcxproj"
    click RendererApp "https://github.com/winderton/xplatform/blob/master/renderer/src/main.cpp"
    click RendererApp "https://github.com/winderton/xplatform/tree/master/renderer/src/glsl"
    click RendererApp "https://github.com/winderton/xplatform/tree/master/renderer/src/Event System"
    click UserlandDemo "https://github.com/winderton/xplatform/blob/master/userland/userland.vcxproj"
    click UserlandDemo "https://github.com/winderton/xplatform/blob/master/userland/src/main.cpp"
    click UserlandDemo "https://github.com/winderton/xplatform/blob/master/userland/Foo.abc"
    click JavaClient "https://github.com/winderton/xplatform/blob/master/java/Client.java"
    click CoreChainLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/core/Block.hpp"
    click CoreChainLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/core/Ledger.hpp"
    click CoreChainLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/core/Merkle.hpp"
    click CoreChainLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/core/Miner.cpp"
    click CoreChainLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/core/Miner.hpp"
    click CoreChainLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/core/Transaction.hpp"
    click CoreChainLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/core/merkleTree.hpp"
    click CoreChainLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/core/Coreutils.cpp"
    click CoreChainLib "https://github.com/winderton/xplatform/blob/master/Blockchain/src/core/Coreutils.hpp"
    click CICD "https://github.com/winderton/xplatform/blob/master/.github/workflows/cmake.yml"
    click Vendor "https://github.com/winderton/xplatform/tree/master/vendor"
    click Vendor "https://github.com/winderton/xplatform/blob/master/.gitmodules"

    classDef lib fill:#D0E6FF,stroke:#036,stroke-width:1px
    classDef app fill:#DFF2D8,stroke:#2E7D32,stroke-width:1px
    classDef ext fill:#F0F0F0,stroke:#555,stroke-width:1px
    classDef ci fill:#FFE0B2,stroke:#E65100,stroke-width:1px
```
