systemspec-architecture

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: MIT

README

Systems Architecture Spec (SAS)

Go CI Go Lint Go SAST Docs Docs Visualization License

A statically-typed-friendly, Go-first specification for describing software systems as semantic graphs: nodes, typed relationships, boundaries, identities, entitlements, and protocol bindings.

Architecture is a typed graph with properties and constraints; diagrams are views over that graph.

Primary responsibility

The primary responsibility of this project is the semantic model itself — a spec whose typed graph carries enough meaning that machines can reason over an architecture without human interpretation. Diagrams, threat modeling, launch readiness, and change analysis are use-case requirements: they determine what semantics the core must express and prove the model works in practice, but they are consumers of the spec, not the spec.

If a use case needs something the model can't express, the model changes. If only one use case wants something, it belongs in a consumer, a profile, or a namespaced extension — never in the core.

Status

v0.2. The core semantic model, validation engine, three renderers, technology catalogs, PIDL protocol bindings, the Threat Model Spec bridge, and assurance coverage reporting are implemented and dogfooded end to end. v0.2 adds a semantic diff engine (typed ChangeSet with change-impact classification and a Baseline/Assessment/ChangeReview model), a FedRAMP change-assessment profile, and container/sandbox node and boundary kinds for K8s-native topology. See SPEC.md for the normative specification and docs/specs/initiatives/INIT-SYSTEMSARCHITECTURESPEC-001/ for the PRD, TRD, PLAN, and ROADMAP.

Packages

Package Responsibility
sas the core semantic graph — Architecture, Node, Relationship, Boundary, Identity, Entitlement, View, ProtocolBinding, Assurance, Extensions
validate referential-integrity checks plus profile-conditional rules (development, deployment, security, threat-model, sre)
render shared rendering foundation (node grouping, shape/label mapping) used by every renderer
render/mermaid, render/d2, render/dot view → diagram renderers, each verified against the real mmdc/d2/dot compilers
catalog AWS/GCP/Kubernetes technology display data and HTTP/SQL/MCP operation mappings
bridge/threatmodel exports an Architecture as the system-under-analysis for Threat Model Spec, verified against its real JSON Schema
diff semantic diff engine — typed ChangeSet, change-impact classification, and the Baseline/Assessment/ChangeReview model
diff/fedramp FedRAMP change-assessment profile — three-outcome classification with control-mapping hooks
assure assurance-reference coverage reporting (tests, metrics, detections, deployment)
cli business logic shared by every CLI command
cmd/sas thin Cobra adapter over cli
schema generated, embedded JSON Schema (//go:embed), linted with schemakit --property-case camelCase
ts generated Zod/TypeScript types, conforming to the same fixture corpus as the Go model

CLI

sas validate <architecture.json> [--profile development,deployment,security,threat-model,sre] [--format console|json]
sas view <architecture.json> [--view <id> | --group-by --include-kinds --include-relations --include-boundaries] --format mermaid|d2|dot
sas bind <architecture.json> --pidl <protocol.json> [--format console|json]
sas export threat-model <architecture.json>
sas assure <architecture.json> [--format console|json]

sas validate --profile security is the launch-readiness gate: run it before a system with internet-facing traffic goes to production (see SPEC.md §10.1).

Example

examples/dogfood/acme-widgets.json is a fictional storefront (browser actor, API, orders database, payment provider, GitHub OAuth login) exercising the full field surface — boundaries, views, a PIDL binding, and launch-readiness-clean relationships:

go run ./cmd/sas validate examples/dogfood/acme-widgets.json --profile security
go run ./cmd/sas view examples/dogfood/acme-widgets.json --view context --format d2

Design principles

  • Statically Typed Friendly. Go structs are the source of truth. JSON Schema is generated (never hand-written) and stays within the PlexusOne static-type profile: no oneOf / anyOf / allOf, no schema composition. Explicit discriminated fields instead of unions. TypeScript/Zod conform downstream. JSON is the interoperability contract — it never becomes a second type system.
  • Views are queries, not files. One canonical model produces development, deployment, security, and threat-model projections without semantic drift. Renderers (Mermaid, D2, Graphviz DOT) are adapters, never sources of truth.
  • Profiles, not levels. Semantics are optional in the core and required only by the profile that needs them, so a minimal architecture file stays minimal.
  • Core ontology, not a technology catalog. "AWS Lambda" is not a core type — it's kind: compute.function + technology: {provider: aws, service: lambda}. Concrete vendor semantics live in catalogs outside the core schema.
  • Integration layer, not universal schema. SAS binds to specialized specs by reference — PIDL for protocol choreography, Threat Model Spec for risk reasoning, Multi-Agent Spec for agent definitions — rather than absorbing them.

License

MIT — see LICENSE.

Directories

Path Synopsis
Package assure computes assurance-reference coverage over a sas.Architecture: which nodes and relationships declare tests, metrics, detections, and deployment evidence, and which don't.
Package assure computes assurance-reference coverage over a sas.Architecture: which nodes and relationships declare tests, metrics, detections, and deployment evidence, and which don't.
bridge
threatmodel
Package threatmodel exports a sas.Architecture as the system-under-analysis for github.com/grokify/threat-model-spec: a DFD (data flow diagram) of components, boundaries, and flows, so a threat model never re-describes the system it analyzes.
Package threatmodel exports a sas.Architecture as the system-under-analysis for github.com/grokify/threat-model-spec: a DFD (data flow diagram) of components, boundaries, and flows, so a threat model never re-describes the system it analyzes.
Package catalog provides technology-specific display metadata and protocol-operation-to-generic-verb mappings, kept outside the core sas package on purpose: "AWS Lambda" is not a core NodeKind, it's Kind "compute.function" plus Technology{Provider: "aws", Service: "lambda"}.
Package catalog provides technology-specific display metadata and protocol-operation-to-generic-verb mappings, kept outside the core sas package on purpose: "AWS Lambda" is not a core NodeKind, it's Kind "compute.function" plus Technology{Provider: "aws", Service: "lambda"}.
Package cli implements the business logic behind the sas command-line tool: loading architecture documents and running library packages (validate, and later render/diff/bind) against them, plus formatting results for console or JSON output.
Package cli implements the business logic behind the sas command-line tool: loading architecture documents and running library packages (validate, and later render/diff/bind) against them, plus formatting results for console or JSON output.
cmd
sas command
Command sas is the CLI for the Systems Architecture Spec.
Command sas is the CLI for the Systems Architecture Spec.
Package diff computes a typed ChangeSet between two versions of a sas.Architecture: which nodes, relationships, and boundaries were added, removed, or modified, and which specific fields changed on each.
Package diff computes a typed ChangeSet between two versions of a sas.Architecture: which nodes, relationships, and boundaries were added, removed, or modified, and which specific fields changed on each.
fedramp
Package fedramp is a compliance profile layered on top of the generic diff package: it classifies a diff.ChangeImpact into FedRAMP's three-outcome change-assessment vocabulary (no review required, change assessment required, potential significant change).
Package fedramp is a compliance profile layered on top of the generic diff package: it classifies a diff.ChangeImpact into FedRAMP's three-outcome change-assessment vocabulary (no review required, change assessment required, potential significant change).
Package render holds logic shared by every format-specific renderer (render/mermaid, render/d2, render/dot): grouping selected nodes by boundary membership and choosing a node shape and edge label from the semantic model.
Package render holds logic shared by every format-specific renderer (render/mermaid, render/d2, render/dot): grouping selected nodes by boundary membership and choosing a node shape and edge label from the semantic model.
d2
Package d2 renders a sas.Architecture, filtered through a sas.View, as D2 diagram source (https://d2lang.com).
Package d2 renders a sas.Architecture, filtered through a sas.View, as D2 diagram source (https://d2lang.com).
dot
Package dot renders a sas.Architecture, filtered through a sas.View, as Graphviz DOT source.
Package dot renders a sas.Architecture, filtered through a sas.View, as Graphviz DOT source.
mermaid
Package mermaid renders a sas.Architecture, filtered through a sas.View, as a Mermaid flowchart.
Package mermaid renders a sas.Architecture, filtered through a sas.View, as a Mermaid flowchart.
Package sas defines the canonical Systems Architecture Spec (SAS) graph model: the typed nodes, relationships, boundaries, identities, and entitlements that make up a machine-readable description of a software system.
Package sas defines the canonical Systems Architecture Spec (SAS) graph model: the typed nodes, relationships, boundaries, identities, and entitlements that make up a machine-readable description of a software system.
Package schema embeds the JSON Schema document generated from the sas.Architecture Go type.
Package schema embeds the JSON Schema document generated from the sas.Architecture Go type.
Package validate applies profile-conditional rules to a sas.Architecture.
Package validate applies profile-conditional rules to a sas.Architecture.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL