N
NSG/Docs

.nsg.json Schema

The portable graph document format used by NSG Studio, CLI, API, SDK, and embedded viewers.

Overview

.nsg.json describes graph structure, layers, nodes, edges, stack compositions, metadata, and visual hints.

It does not expose NSG's proprietary rendering engine, scanner heuristics, layout algorithms, or internal runtime.

Key principle: .nsg.json tells NSG what the graph is. The NSG runtime decides how to render it.

Minimal Example

example.nsg.json
{
  "nsgVersion": "1.0",
  "id": "example",
  "name": "Example Graph",
  "theme": "quantum",
  "mode": "nested",
  "entry": {
    "layerId": "root"
  },
  "layers": {
    "root": {
      "id": "root",
      "name": "Root",
      "layoutMode": "grid",
      "archetype": "default",
      "nodes": [
        {
          "id": "node-1",
          "label": "Node 1",
          "shape": "cube"
        }
      ],
      "edges": []
    }
  }
}

Root Properties

PropertyTypeDescription
nsgVersionstringSchema version (e.g., "1.0")
idstringUnique identifier for the graph
namestringDisplay name
themestringVisual theme (e.g., "quantum", "dark")
modestringRendering mode ("nested", "flat")
entryobjectEntry point configuration
layersobjectMap of layer ID to layer definition

Layer Properties

PropertyTypeDescription
idstringUnique layer identifier
namestringDisplay name
layoutModestring"grid", "force", "flow", "tree", "radial"
archetypestringVisual archetype for rendering
nodesarrayArray of node objects
edgesarrayArray of edge objects

Node Properties

PropertyTypeDescription
idstringUnique node identifier
labelstringDisplay label
shapestring"cube", "sphere", "folder", "file", etc.
childLayerIdstring?Makes node a portal to another layer
metadataobject?Custom metadata for inspection

Related Documentation