{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "Infernus Monorepo and Packages",
    "locale": "en",
    "quality_profile": "showcase"
  },
  "layout": {
    "mode": "grid",
    "origin": [
      20,
      40
    ],
    "cols": 10,
    "gapX": 8,
    "gapY": 34,
    "cellW": 120,
    "cellH": 60
  },
  "components": [
    {
      "id": "create_app",
      "type": "backend",
      "label": "create-app",
      "sublabel": "scaffolding CLI",
      "row": 0,
      "col": 0
    },
    {
      "id": "gamemode",
      "type": "frontend",
      "label": "Gamemode script",
      "sublabel": "gamemode entry",
      "row": 1,
      "col": 0
    },
    {
      "id": "core_pkg",
      "type": "backend",
      "label": "@infernus/core",
      "sublabel": "core library",
      "row": 2,
      "col": 0
    },
    {
      "id": "samp_node",
      "type": "cloud",
      "label": "samp-node",
      "sublabel": "Node runtime",
      "row": 3,
      "col": 0
    },
    {
      "id": "fs_pkg",
      "type": "backend",
      "label": "@infernus/fs",
      "sublabel": "bundled scripts",
      "row": 0,
      "col": 1
    },
    {
      "id": "types_pkg",
      "type": "backend",
      "label": "@infernus/types",
      "sublabel": "ambient types",
      "row": 1,
      "col": 1
    },
    {
      "id": "omp_server",
      "type": "cloud",
      "label": "open.mp Server",
      "sublabel": "server host",
      "row": 2,
      "col": 1
    },
    {
      "id": "nodejs",
      "type": "cloud",
      "label": "Node.js 22",
      "sublabel": "JS runtime",
      "row": 3,
      "col": 1
    },
    {
      "id": "shared_pkg",
      "type": "external",
      "label": "@infernus/shared",
      "sublabel": "build-time code",
      "row": 3,
      "col": 2
    },
    {
      "id": "raknet",
      "type": "backend",
      "label": "raknet",
      "sublabel": "network packets",
      "row": 0,
      "col": 3
    },
    {
      "id": "nex_ac",
      "type": "security",
      "label": "nex-ac",
      "sublabel": "anti-cheat",
      "row": 0,
      "col": 4
    },
    {
      "id": "weapon_config",
      "type": "security",
      "label": "weapon-config",
      "sublabel": "weapon damage",
      "row": 1,
      "col": 3
    },
    {
      "id": "query",
      "type": "backend",
      "label": "query",
      "sublabel": "server queries",
      "row": 1,
      "col": 4
    },
    {
      "id": "streamer",
      "type": "backend",
      "label": "streamer",
      "sublabel": "entity streaming",
      "row": 0,
      "col": 6
    },
    {
      "id": "colandreas",
      "type": "backend",
      "label": "colandreas",
      "sublabel": "collision query",
      "row": 0,
      "col": 7
    },
    {
      "id": "mapandreas",
      "type": "backend",
      "label": "mapandreas",
      "sublabel": "terrain heights",
      "row": 0,
      "col": 8
    },
    {
      "id": "map_loader",
      "type": "backend",
      "label": "map-loader",
      "sublabel": "map file loading",
      "row": 1,
      "col": 6
    },
    {
      "id": "mapfix",
      "type": "backend",
      "label": "mapfix",
      "sublabel": "map hole fixes",
      "row": 1,
      "col": 7
    },
    {
      "id": "gps",
      "type": "backend",
      "label": "gps",
      "sublabel": "navigation",
      "row": 1,
      "col": 8
    },
    {
      "id": "cef",
      "type": "backend",
      "label": "cef",
      "sublabel": "in-game browser",
      "row": 2,
      "col": 3
    },
    {
      "id": "ompp",
      "type": "backend",
      "label": "ompp",
      "sublabel": "open.mp extras",
      "row": 2,
      "col": 4
    },
    {
      "id": "progress",
      "type": "backend",
      "label": "progress",
      "sublabel": "progress bars",
      "row": 2,
      "col": 5
    },
    {
      "id": "qrcode",
      "type": "backend",
      "label": "qrcode",
      "sublabel": "QR codes",
      "row": 3,
      "col": 3
    },
    {
      "id": "s_art",
      "type": "backend",
      "label": "s-art",
      "sublabel": "image rendering",
      "row": 3,
      "col": 4
    },
    {
      "id": "e_selection",
      "type": "backend",
      "label": "e-selection",
      "sublabel": "model menu",
      "row": 3,
      "col": 5
    },
    {
      "id": "fcnpc",
      "type": "backend",
      "label": "fcnpc",
      "sublabel": "NPCs and bots",
      "row": 2,
      "col": 7
    },
    {
      "id": "samp_voice",
      "type": "backend",
      "label": "samp-voice",
      "sublabel": "voice chat",
      "row": 2,
      "col": 8
    },
    {
      "id": "veh_para",
      "type": "backend",
      "label": "veh-para",
      "sublabel": "vehicle parachute",
      "row": 2,
      "col": 9
    },
    {
      "id": "distance",
      "type": "backend",
      "label": "distance",
      "sublabel": "distance maths",
      "row": 3,
      "col": 7
    },
    {
      "id": "drift_detection",
      "type": "backend",
      "label": "drift-detection",
      "sublabel": "drift detection",
      "row": 3,
      "col": 8
    },
    {
      "id": "rec",
      "type": "backend",
      "label": "rec",
      "sublabel": ".rec conversion",
      "row": 3,
      "col": 9
    }
  ],
  "boundaries": [
    {
      "kind": "region",
      "label": "Network and anti-cheat",
      "wraps": [
        "raknet",
        "nex_ac",
        "weapon_config",
        "query"
      ]
    },
    {
      "kind": "region",
      "label": "World and navigation",
      "wraps": [
        "streamer",
        "colandreas",
        "mapandreas",
        "map_loader",
        "mapfix",
        "gps"
      ]
    },
    {
      "kind": "region",
      "label": "Interface",
      "wraps": [
        "cef",
        "ompp",
        "progress",
        "qrcode",
        "s_art",
        "e_selection"
      ]
    },
    {
      "kind": "region",
      "label": "Players and gameplay",
      "wraps": [
        "fcnpc",
        "samp_voice",
        "veh_para",
        "distance",
        "drift_detection",
        "rec"
      ]
    }
  ],
  "connections": [
    {
      "id": "createapp-scaffolds-gamemode",
      "from": "create_app",
      "to": "gamemode",
      "label": "scaffold",
      "labelAt": [
        80,
        114
      ]
    },
    {
      "id": "gamemode-imports-core",
      "from": "gamemode",
      "to": "core_pkg",
      "label": "import core",
      "variant": "emphasis",
      "labelAt": [
        80,
        208
      ]
    },
    {
      "id": "core-calls-native",
      "from": "core_pkg",
      "to": "samp_node",
      "label": "callNative",
      "variant": "emphasis",
      "labelAt": [
        80,
        302
      ]
    }
  ],
  "cards": [
    {
      "dot": "cyan",
      "title": "Three implementation styles",
      "items": [
        "Wrapping a native plugin: raknet, streamer, colandreas, cef, ompp and fcnpc expose plugin natives as typed functions",
        "Enhancing core behaviour: nex-ac, weapon-config, veh-para and distance replace core's native calls to rewrite damage and position logic",
        "Pure TypeScript: mapandreas, rec, query and e-selection need no native plugin at all"
      ]
    },
    {
      "dot": "emerald",
      "title": "Extension points in core",
      "items": [
        "defineEvent declares an event; listeners form a middleware chain advanced by next()",
        "defineHooks(Class) returns the original method snapshot plus setHook, for replacing class methods",
        "GameMode.use() only queues; loading happens in onInit"
      ]
    },
    {
      "dot": "violet",
      "title": "Build and runtime boundary",
      "items": [
        "scripts/build-all.ts builds serially: streamer, core, raknet, then the rest",
        "Each package type-checks then bundles to bundle.mjs / bundle.js / bundle.d.ts",
        "samp-node is loaded by open.mp and injects global samp; streamer and types are unpublished"
      ]
    }
  ]
}
