Skip to main content

Architecture Diagram Kit

Use this page as a canonical source for building architecture diagrams for the repository.

It provides normalized IDs, node definitions, edge lists, and sequence flows that can be mapped directly to Mermaid, C4, Excalidraw, or draw.io.

Scope

The model covers:

  • System context around nyxd
  • Internal daemon component architecture
  • Runtime sequence for nyx run
  • Reconciliation sequence for nyx compose up
  • Persistent data layout

Naming and ID conventions

  • Stable node IDs use uppercase snake case.
  • Edge IDs use E##.
  • Sequence step IDs use R## (run flow) and C## (compose flow).
  • Keep labels short and use file paths in notes.

1) System context nodes

IDLabelTypeNotes
USEROperatorActorHuman user running CLI commands
NYXnyx CLIApplicationcmd/nyx/main.go
NYXDnyxd DaemonApplicationcmd/nyxd/main.go
CRUNcrunExternal RuntimeOCI runtime binary
REGISTRYOCI RegistryExternal ServiceDocker Hub or compatible registry
KERNELLinux Kernel FeaturesPlatformnetns, cgroups, overlayfs, nftables
CNI_PLUGINSCNI PluginsOptional ExternalUsed only when -net-driver=cni
DATA_STOREnyxd Data DirectoryStorageDefault /var/lib/nyxd

2) System context edges

IDFromToProtocolMeaning
E01USERNYXCLI invocationUser runs commands
E02NYXNYXDHTTP over Unix socketControl API calls
E03NYXDCRUNProcess execRuntime lifecycle operations
E04NYXDREGISTRYHTTPSManifest and blob pulls
E05NYXDKERNELSyscalls and net toolsNamespaces, mount, network setup
E06NYXDCNI_PLUGINSCNI execOptional CNI ADD/DEL flows
E07NYXDDATA_STOREFilesystem IOImages, bundles, logs, state

3) Internal daemon container map

IDLabelResponsibilityPrimary Source
D01Control APIRoute and validate API requestsinternal/control/server.go
D02SupervisorContainer lifecycle and policy loopinternal/supervisor/supervisor.go
D03Compose BuilderCompose parse/validate/spec generationinternal/compose/specs.go
D04Image Store and PullerResolve, pull, verify OCI imagesinternal/image/puller.go
D05Overlay ManagerLayer extraction and overlay mountinternal/overlay/overlay.go
D06Bundle GeneratorOCI config.json creationinternal/bundle/bundle.go
D07Runtime Adaptercrun command wrapperinternal/runtime/crun.go
D08Network BackendNative or CNI container networkinginternal/network/backend.go
D09DNS BackendEmbedded/noop resolver policyinternal/netdns/backend.go
D10Health SubsystemReadiness and health probesinternal/health/health.go
D11Log CollectorStream and persist container logsinternal/logs/logger.go
D12Persist and ReconcileState persistence and re-adoptioninternal/supervisor/persist.go

4) Internal component edges

IDFromToMeaning
E20D01D03Compose endpoints build service specs
E21D01D02Run/stop/remove/compose lifecycle requests
E22D01D04Pull/list/remove/prune image operations
E23D03D04Ensure images exist for compose services
E24D03D02Submit ordered desired service specs
E25D02D05Prepare and teardown container rootfs
E26D02D08Setup and teardown container networking
E27D02D06Build OCI bundle configuration
E28D02D07Execute runtime lifecycle operations
E29D02D10Run readiness and health monitoring
E30D02D11Attach and stream process logs
E31D02D12Persist supervised state and reconcile
E32D02D09Register and deregister service DNS records

5) Runtime sequence matrix (nyx run)

StepFromToAction
R01USERNYXRun nyx run <image>
R02NYXD01POST /v1/containers/run
R03D01D04Resolve or pull image if absent
R04D01D02Build ContainerSpec and request start
R05D02D05Prepare overlay rootfs
R06D02D08Configure netns and port mappings
R07D02D06Generate bundle config.json
R08D02D07Launch workload through crun
R09D02D11Start log streaming
R10D02D10Start readiness and health tracking
R11D01NYXReturn run result or stream
R12D02D12Persist runtime state

6) Reconcile sequence matrix (nyx compose up)

StepFromToAction
C01USERNYXRun nyx compose up
C02NYXD01POST /v1/compose/up
C03D01D03Parse/validate/interpolate compose file
C04D03D04Resolve or pull referenced service images
C05D03D02Submit dependency-ordered desired specs
C06D02D02Reconcile by service: keep, recreate, or start
C07D02D07Restart changed services via runtime operations
C08D01NYXReturn started/reconciled container IDs

7) Persistent data model

PathPurposeProducer
images/blobs/sha256/*OCI blobsImage puller
images/images/<repo>/<tag>/Manifest/config metadataImage puller
overlay/<id>/Layer extraction and merged rootfsOverlay manager
bundles/<id>/config.jsonOCI runtime bundle specBundle generator
bundles/<id>/nyxd-meta.jsonRuntime metadata for re-adoptionSupervisor
supervisor/containers/<id>.jsonPersisted supervision recordPersist and reconcile module
run/crun/Runtime state rootRuntime adapter and crun
logs/<id>.logContainer log stream (JSONL)Log collector

8) Diagram generation checklist

  1. Use the node IDs as canonical names in all diagrams.
  2. Draw context diagram from section 1 and section 2 only.
  3. Draw internal component diagram from section 3 and section 4.
  4. Draw sequence diagrams from section 5 and section 6.
  5. Draw data layout diagram from section 7.
  6. Keep labels consistent so docs and diagrams do not drift.

9) Suggested documentation placement

  • Overview entry point: Overview
  • Architecture narrative: Architecture
  • This machine-readable mapping: Architecture Diagram Kit