Overall Architecture

1.1 High-level data flow

flowchart LR
  userBrowser[UserBrowser] --> frontendSPA[FrontendSPA]
  frontendSPA -->|HTTP/JSON| apiServer[GoWebAPI]
  apiServer -->|Go calls| graphBuilder[GraphBuilder]
  graphBuilder -->|Go calls| engineWrapper[EngineWrapper]
  engineWrapper -->|CGo calls| engineBridge[CppYGOpenCore]
  engineBridge --> ygoproCore[ygopro-core]
  engineBridge --> ygopenCodec[YGOpenCodec]

  engineWrapper -->|protobuf Duel.Msg / Answer| graphBuilder
  graphBuilder -->|Graph(nodes,edges)| apiServer
  apiServer -->|Graph JSON| frontendSPA

2. Engine Wrapper (Go + CGo + YGOpen) — Primary Focus

2.1 Objectives

2.2 Repo layout assumptions

2.3 YGOpen / protobuf setup

    protoc \\
      --go_out=./ygo-visualizer/ygopenpb --go_opt=paths=source_relative \\
      ygopen/include/ygopen/proto/duel_data.proto \\
      ygopen/include/ygopen/proto/duel_msg.proto \\
      ygopen/include/ygopen/proto/duel_answer.proto

2.4 C++ bridge API design

Design a minimal C API that Go will call (implemented in C++, compiled into a DLL that Go links against):