Model
SOFE Architecture Graph — a directed in-memory graph with typed relations. No database — pure in-memory, built for fast analysis (blast radius, impact, cost) in agents, CLI and CI.
Node
A deployable unit / resource / service / document.
| Field | Type | Description |
|---|---|---|
id |
string |
Unique identifier |
label |
string? |
Display label |
type |
string? |
e.g. aws.lambda, python-library, cf-worker |
attrs |
Record<string, any> |
Free attrs: owner, monthly_cost, region, repo… |
Analysis functions consume attrs.monthly_cost (cost) and attrs.owner (team).
Edge
A directed, typed relation between two nodes.
| Field | Type | Description |
|---|---|---|
from |
string |
Source node |
to |
string |
Target node |
relType |
string |
e.g. routes_to, reads_writes, triggers, depends, calls, bundles |
label |
string? |
Edge label / action |
Adding an edge auto-creates missing nodes.
relType
Open convention: routes_to, reads, writes, reads_writes, triggers, calls, depends, bundles, proxies, uses, monitors.
Filtering by relType is key: traverse only the edges that matter (e.g. only reads_writes for data impact).
Traversal
- BFS (
traverseBFS): level-by-level (queue) - DFS (
traverseDFS): depth-first (stack, pre-order)
Options: relTypes?, maxDepth?, direction?: 'outgoing' | 'incoming' | 'both'. Returns reachable ids excluding start.
Blast Radius
What breaks if this service fails.
All nodes reachable downstream (BFS outgoing) from a start node.
blastRadius(g, 'api'); // everything that depends on api
Cost Chain
How much (USD/mo) if this goes down.
Sum of attrs.monthly_cost for: the start node + all of its blast radius.
costChain(g, 'api'); // start + downstream monthly cost
Team Cost
Sum of attrs.monthly_cost for all nodes where attrs.owner === X.
Fan-in / SPOF
- Fan-in: how many incoming edges a node has (how many depend on it)
- SPOF: nodes with fan-in
>= threshold— critical if they fail
singlePointsOfFailure(g, 3); // nodes with fan-in >= 3
Direction
| Direction | Semantics |
|---|---|
outgoing |
this node → others |
incoming |
others → this node |
both |
both |
Sources
nan-graph extracts analysis from: SOFE engine/architecture.py (blast_radius, cost_chain, fan_in, single_points_of_failure), cc-mng graph/data.ts (GraphNode/GraphEdge), and dependency-graph.yaml input format. Fusion of Ñan × BYaML v2.