Skip to content

c4 schema (v0.5)

The models/c4.json file is validated by the normative JSON Schema published at its canonical URL:

PropertyTypeRequiredDescription
kind"c4-file"yes
schemaVersionC4SchemaVersionyes
personsC4Person[]yesPeople/actors (Context level).
softwareSystemsC4SoftwareSystem[]yesTop-level software systems (Context level).
containersC4Container[]yesDeployable units (Container level).
componentsC4Component[]yesComponents — drill-down (Container→Component).
relationshipsC4Relationship[]yesDirected relationships between elements (endpoints may also be deployment instance/infrastructure ids — 0.4.0).
invariantsC4Invariant[]yesOptional cross-cutting architecture rules.
groupsC4Group[]noOptional named element groupings (0.3.0 — C4-004).
viewsC4AnyView[]noSaved views — filtered (0.3.0) + dynamic/deployment/custom (0.4.0).
deploymentEnvironmentsC4DeploymentEnvironment[]noDeployment topology (0.4.0 — Structurizr parity).
stylesC4StylesnoStyling — tag-matched element/relationship styles + theme (0.4.0).
impliedRelationshipsbooleannoWhen true, renderers/exporters add IMPLIED relationships (0.4.0): a relationship between nested elements (component/container/system) implies the same relationship between every ancestor pair, unless an explicit relationship already exists. Derived — never persisted.
regeneratedAtstringnoISO timestamp of the last regenerate-from-models action. Set by the regenerate endpoint; absent on hand-authored files. Used by the idempotency check (T4) — a regenerate call returns 409 Conflict if the file has been hand-edited since this timestamp, unless ?force=1.
regeneratedFromstringnoSource models used for the last regenerate (e.g. "sim+ddd+dsm+scm").
visualisationSetupVisualisationSetupnoCanvas viewport, zoom, etc.

One animation step: elements revealed together, in order sequence.

PropertyTypeRequiredDescription
ordernumberyes1-based step number.
elementIdsstring[]yesElement ids revealed by this step.

Any saved view (0.4.0 union — old files only ever carry C4View).

Type: C4View | C4DynamicView | C4DeploymentView | C4CustomView

Component — internal module of a container.

PropertyTypeRequiredDescription
kind"component"yes
idstringyesStable identifier (canvas-unique). Often the slugified name.
namestringyesHuman-readable display name (e.g. "Web App", "Stripe").
descriptionstringnoOptional longer-form description of the element's responsibility.
technologystringnoTechnology label (e.g. "Next.js", "PostgreSQL 15").
tagsstring[]noTags for filtering, styling, and cross-model linking.
positionobjectnoCanvas position.
externalIdstringnoCross-model links (e.g. ddd:Aggregate:orders). Optional.
propertiesRecord<string, string>noStructurizr-compatible key-value bag (e.g. { "cbrl:REQ-001": "orders" }).
urlstringnoDrill-down link (docs, source, tests).
documentationstringnoLong-form element documentation (markdown).
containerIdstringyesOwning container (id reference).

Container — deployable unit inside a system.

PropertyTypeRequiredDescription
kind"container" | "container-db"yes
idstringyesStable identifier (canvas-unique). Often the slugified name.
namestringyesHuman-readable display name (e.g. "Web App", "Stripe").
descriptionstringnoOptional longer-form description of the element's responsibility.
technologystringnoTechnology label (e.g. "Next.js", "PostgreSQL 15").
tagsstring[]noTags for filtering, styling, and cross-model linking.
positionobjectnoCanvas position.
externalIdstringnoCross-model links (e.g. ddd:Aggregate:orders). Optional.
propertiesRecord<string, string>noStructurizr-compatible key-value bag (e.g. { "cbrl:REQ-001": "orders" }).
urlstringnoDrill-down link (docs, source, tests).
documentationstringnoLong-form element documentation (markdown).
systemIdstringyesOwning software system (id reference).
technologyBucketC4TechnologynoBucketed technology (drives icon/color on canvas).
monthlyCostC4MonthlyCostnoDeclared monthly running cost (0.5.0 — M25 cost overlays).

An instance of a container deployed inside a deployment node.

PropertyTypeRequiredDescription
kind"container-instance"yes
idstringyes
containerIdstringyesOwning container (id reference).
instanceNumbernumberno
deploymentGroupsstring[]no
tagsstring[]no
propertiesRecord<string, string>no
urlstringno
healthChecksC4HealthCheck[]no

Authored custom view (0.4.0) — an arbitrary explicit subset.

PropertyTypeRequiredDescription
keystringyesStable slug (unique within the file) — e.g. "security".
titlestringyes
descriptionstringno
isDefaultbooleannoWhen true, the recipe prompt renders this view by default.
kind"custom-view"yes
elementIdsstring[]yes
relationshipIdsstring[]noWhen absent, all relationships between the included elements show.

A named deployment environment (e.g. “Development”, “Live”).

PropertyTypeRequiredDescription
kind"deployment-environment"yes
idstringyes
namestringyesEnvironment name — referenced by deployment views.
descriptionstringno
deploymentNodesC4DeploymentNode[]yes

A deployment node — physical/virtual infrastructure that hosts instances. Recursive: nodes nest (data center → cluster → machine → container runtime).

PropertyTypeRequiredDescription
kind"deployment-node"yes
idstringyes
namestringyes
descriptionstringno
technologystringno
instancesnumbernoNumber of instances of this node (default 1).
tagsstring[]no
propertiesRecord<string, string>no
urlstringno
positionobjectno
childrenC4DeploymentNode[]yesNested deployment nodes.
infrastructureNodesC4InfrastructureNode[]yes
softwareSystemInstancesC4SoftwareSystemInstance[]yes
containerInstancesC4ContainerInstance[]yes

Authored deployment view (0.4.0) — projects one deployment environment.

PropertyTypeRequiredDescription
keystringyesStable slug (unique within the file) — e.g. "security".
titlestringyes
descriptionstringno
isDefaultbooleannoWhen true, the recipe prompt renders this view by default.
kind"deployment-view"yes
environmentstringyesDeployment environment name this view projects.
softwareSystemIdstringnoOptional explicit software-system filter (id).
includeIdsstring[]no
excludeIdsstring[]no

One ordered interaction in a dynamic view (0.4.0).

PropertyTypeRequiredDescription
ordernumberyes1-based display order (numbered on the diagram).
relationshipIdstringnoReference an existing relationship — inherits endpoints + label.
sourceIdstringnoInline endpoints (used when relationshipId is absent).
targetIdstringno
labelstringnoLabel override (or the inline step's label).
technologystringno

Authored dynamic view (0.4.0) — an ordered list of interaction steps. scopeId mirrors Structurizr (* | system id | container id).

PropertyTypeRequiredDescription
keystringyesStable slug (unique within the file) — e.g. "security".
titlestringyes
descriptionstringno
isDefaultbooleannoWhen true, the recipe prompt renders this view by default.
kind"dynamic-view"yes
scopeIdstringno
stepsC4DynamicStep[]yes

Per-tag element style — first matching tag wins (later tags lose).

PropertyTypeRequiredDescription
tagstringyesThe element tag this style applies to.
backgroundstringnoFill color (hex like "#3b82f6" or CSS color name).
colorstringnoText color.
strokestringnoBorder color.
strokeWidthnumbernoBorder width, 1–10.
shapeC4Shapeno
borderC4LineStyleno
fontSizenumberno
iconstringnoIcon URL.
widthnumberno
heightnumberno
opacitynumberno0–100.
metadatabooleannoShow the technology/metadata line.
descriptionbooleannoShow the description line.

Named grouping of elements — first-class in 0.3.0 (C4-004).

PropertyTypeRequiredDescription
kind"group"yes
idstringyes
namestringyes
elementIdsstring[]yesElement ids belonging to this grouping (persons/systems/containers).

A health check attached to a container/software-system instance.

PropertyTypeRequiredDescription
idstringyes
namestringno
urlstringyesURL the instance is pinged on (http/https).
intervalnumberyesInterval between checks, in seconds.
timeoutnumberyesTimeout for each check, in seconds.
headersRecord<string, string>noRequest headers (e.g. { Authorization: "Basic …" }).

Infrastructure element inside a deployment node (load balancer, DNS, …).

PropertyTypeRequiredDescription
kind"infrastructure-node"yes
idstringyes
namestringyes
descriptionstringno
technologystringno
tagsstring[]no
propertiesRecord<string, string>no
urlstringno
PropertyTypeRequiredDescription
kind"invariant"yes
idstringyes
namestringyes
expressionstringyesHuman-readable assertion, e.g. "no direct DB access from the SPA".
involvedElementsstring[]yesElement ids the invariant spans.
severityC4InvariantSeverityyes
categoryC4InvariantCategoryyes

Type: "performance" | "security" | "scalability" | "compliance" | "resilience"

Type: "warning" | "error" | "critical"

Border / line style shared by element borders and relationship lines.

Type: "solid" | "dashed" | "dotted"

Declared monthly running cost of a deployable unit (0.5.0 — M25 cost overlays; the Vantage/CloudZero “$/container” lens). Optional and OMITTED when unknown, so cost-free models produce byte-identical files. Observed costs arrive separately via the M4 live-state collector convention — this is the declared, authored number.

PropertyTypeRequiredDescription
amountnumberyesMonthly amount in currency (e.g. 420, 1240.5).
currencystringyesISO 4217 code (e.g. "USD", "EUR").
sourcestringnoWhere the number came from (e.g. "aws-cost-explorer", "estimate").

Person — external actor (user, system owner).

PropertyTypeRequiredDescription
kind"person"yes
idstringyesStable identifier (canvas-unique). Often the slugified name.
namestringyesHuman-readable display name (e.g. "Web App", "Stripe").
descriptionstringnoOptional longer-form description of the element's responsibility.
technologystringnoTechnology label (e.g. "Next.js", "PostgreSQL 15").
tagsstring[]noTags for filtering, styling, and cross-model linking.
positionobjectnoCanvas position.
externalIdstringnoCross-model links (e.g. ddd:Aggregate:orders). Optional.
propertiesRecord<string, string>noStructurizr-compatible key-value bag (e.g. { "cbrl:REQ-001": "orders" }).
urlstringnoDrill-down link (docs, source, tests).
documentationstringnoLong-form element documentation (markdown).

Directed relationship between two C4 elements.

PropertyTypeRequiredDescription
kind"relationship"yes
idstringyes
sourceIdstringyes
targetIdstringyes
typeC4RelationshipTypeyes
labelstringnoOptional human-readable label overriding type.
protocolstringnoOptional technology of the connection (HTTP, gRPC, JDBC, NATS, …).
descriptionstringnoOptional explanation of WHY the relationship exists.
tagsstring[]noTags for filtering and styling (0.4.0 — Structurizr parity).
propertiesRecord<string, string>noStructurizr-compatible key-value bag (0.4.0).
urlstringnoDrill-down link (0.4.0).

Per-tag relationship style — first matching tag wins.

PropertyTypeRequiredDescription
tagstringyes
colorstringno
thicknessnumbernoLine thickness.
styleC4LineStyleno
routing"direct" | "orthogonal" | "curved"no
fontSizenumberno
widthnumbernoLabel width.
positionnumbernoLabel position along the line, 0–100.
opacitynumberno0–100.

Relationship verb between two C4 elements.

Type: "calls" | "reads-from" | "writes-to" | "publishes-event" | "subscribes-to" | "uses" | "depends-on" | "delivers-to" | "interacts-with"

Schema versions the parser accepts. Save/serialize always emits the latest. 0.5.0 (M25 cost overlays) adds the optional per-container monthlyCost — purely additive, so 0.1.0–0.4.0 files keep parsing and validating (the generated JSON schema carries the version as an enum; old schemas stay under schemas/c4/v0.4/ for existing readers).

Type: "0.1.0" | "0.2.0" | "0.3.0" | "0.4.0" | "0.5.0"

Element shapes (kebab-case; mapped to Structurizr CamelCase on export).

Type: "box" | "rounded-box" | "circle" | "ellipse" | "hexagon" | "diamond" | "cylinder" | "bucket" | "pipe" | "person" | "folder" | "component" | "web-browser" | "window" | "mobile-device" | "terminal"

Software System — top-level system boundary.

PropertyTypeRequiredDescription
kind"software-system"yes
idstringyesStable identifier (canvas-unique). Often the slugified name.
namestringyesHuman-readable display name (e.g. "Web App", "Stripe").
descriptionstringnoOptional longer-form description of the element's responsibility.
technologystringnoTechnology label (e.g. "Next.js", "PostgreSQL 15").
tagsstring[]noTags for filtering, styling, and cross-model linking.
positionobjectnoCanvas position.
externalIdstringnoCross-model links (e.g. ddd:Aggregate:orders). Optional.
propertiesRecord<string, string>noStructurizr-compatible key-value bag (e.g. { "cbrl:REQ-001": "orders" }).
urlstringnoDrill-down link (docs, source, tests).
documentationstringnoLong-form element documentation (markdown).
isScopebooleannoTrue if this is the system currently being modeled (vs. external dep).

An instance of a software system deployed inside a deployment node.

PropertyTypeRequiredDescription
kind"software-system-instance"yes
idstringyes
softwareSystemIdstringyesOwning software system (id reference).
instanceNumbernumberno1-based instance number within the environment (Structurizr parity).
deploymentGroupsstring[]noDeployment groups — disambiguates multiple instances in one node.
tagsstring[]no
propertiesRecord<string, string>no
urlstringno
healthChecksC4HealthCheck[]no

File-level styling block (0.4.0).

PropertyTypeRequiredDescription
themestringnoTheme name (e.g. "default", "dark") or https URL.
elementsC4ElementStyle[]yes
relationshipsC4RelationshipStyle[]yes

C4 technology buckets — populate the “technology” label on a container.

Type: "web-app" | "spa" | "mobile" | "api" | "service" | "database" | "message-bus" | "queue" | "cache" | "cdn" | "function" | "external-system" | "browser" | "cli" | "library"

A saved filtered view (0.3.0): tag-include/exclude filter + optional level cut + optional animation steps (0.4.0, Structurizr parity).

PropertyTypeRequiredDescription
keystringyesStable slug (unique within the file) — e.g. "security".
titlestringyes
descriptionstringno
isDefaultbooleannoWhen true, the recipe prompt renders this view by default.
kind"view"yes
levelC4ViewLevelno
includeTagsstring[]noElement is kept if it has ANY of these tags (empty/undefined = all).
excludeTagsstring[]noElement is dropped if it has ANY of these tags.
animationC4AnimationStep[]noOrdered reveal steps (0.4.0).

Which C4 level a view projects. Undefined = all levels.

Type: "landscape" | "context" | "container" | "component"

INTERNAL: Context Studio canvas state only; never emitted to coding agents.

PropertyTypeRequiredDescription
nodePositionsRecord<string, object>yes
zoomLevelnumberyes
viewportobjectno
updatedAtstringno

Representative models/c4.json files committed under samples/c4/. Each demo shows three views — pick the one you want: Canvas (rendered through the same SvelteFlow component the IDE uses), Mermaid (a static-flowchart fallback), or Raw JSON. All assets are locally served; no GitHub redirect.

↓ download
demo-01-context-level.c4.json — Context Studio canvas view

Demo 1 — C4 System Context level: external actors + the system-under-design + immediate external dependencies. Exercises person, software-system (with isScope flag), and relationship nodes.

demo-01-context-level.c4.json — Demo 1 — C4 System Context level: external actors + the system-under-design + immediate external dependencies. Exercises person, software-system (with isScope flag), and relationship nodes. (expand for full JSON)
demo-01-context-level.c4.json
{
"kind": "c4-file",
"schemaVersion": "0.3.0",
"persons": [
{
"kind": "person",
"id": "traveler",
"name": "Traveler",
"description": "End user searching and booking flights.",
"tags": ["external", "primary-actor"],
"position": {
"x": 0,
"y": 0
}
},
{
"kind": "person",
"id": "ops",
"name": "Ops Engineer",
"description": "Internal operator monitoring bookings.",
"tags": ["internal", "secondary-actor"],
"position": {
"x": 0,
"y": 200
}
}
],
"softwareSystems": [
{
"kind": "software-system",
"id": "booking-system",
"name": "Travel Booking System",
"description": "The system under design.",
"isScope": true,
"tags": ["scope", "internal"],
"position": {
"x": 400,
"y": 100
}
},
{
"kind": "software-system",
"id": "stripe",
"name": "Stripe",
"description": "External payment processor.",
"tags": ["external", "saas"],
"position": {
"x": 800,
"y": 0
}
},
{
"kind": "software-system",
"id": "sendgrid",
"name": "SendGrid",
"description": "External email delivery service.",
"tags": ["external", "saas"],
"position": {
"x": 800,
"y": 200
}
}
],
"containers": [],
"components": [],
"relationships": [
{
"kind": "relationship",
"id": "r-traveler-uses",
"sourceId": "traveler",
"targetId": "booking-system",
"type": "uses",
"label": "Books flights",
"protocol": "HTTPS",
"description": "Web + mobile clients."
},
{
"kind": "relationship",
"id": "r-ops-monitors",
"sourceId": "ops",
"targetId": "booking-system",
"type": "uses",
"label": "Monitors bookings",
"protocol": "HTTPS"
},
{
"kind": "relationship",
"id": "r-stripe-charge",
"sourceId": "booking-system",
"targetId": "stripe",
"type": "calls",
"label": "Charges cards",
"protocol": "HTTPS/REST"
},
{
"kind": "relationship",
"id": "r-sendgrid-email",
"sourceId": "booking-system",
"targetId": "sendgrid",
"type": "calls",
"label": "Sends confirmation emails",
"protocol": "HTTPS/REST"
}
],
"invariants": []
}
↓ download
demo-02-container-level.c4.json — Context Studio canvas view

Demo 2 — C4 Container level: deployable units inside the booking system (SPA, API, DB, message bus). Exercises person, software-system, container, container-db (with systemId + technologyBucket + technology), relationship, and invariant nodes.

demo-02-container-level.c4.json — Demo 2 — C4 Container level: deployable units inside the booking system (SPA, API, DB, message bus). Exercises person, software-system, container, container-db (with systemId + technologyBucket + technology), relationship, and invariant nodes. (expand for full JSON)
demo-02-container-level.c4.json
{
"kind": "c4-file",
"schemaVersion": "0.3.0",
"persons": [
{
"kind": "person",
"id": "traveler",
"name": "Traveler",
"tags": ["external"],
"position": {
"x": 0,
"y": 0
}
}
],
"softwareSystems": [
{
"kind": "software-system",
"id": "booking-system",
"name": "Travel Booking System",
"isScope": true,
"tags": ["scope"]
}
],
"containers": [
{
"kind": "container",
"id": "spa",
"name": "Web SPA",
"description": "Customer-facing single-page app.",
"systemId": "booking-system",
"technologyBucket": "spa",
"technology": "Next.js 15 + React 19",
"tags": ["frontend", "public"],
"position": {
"x": 200,
"y": 0
}
},
{
"kind": "container",
"id": "api",
"name": "Booking API",
"description": "Backend REST/GraphQL API.",
"systemId": "booking-system",
"technologyBucket": "api",
"technology": "SvelteKit 2 + Bun",
"tags": ["backend"],
"position": {
"x": 500,
"y": 0
}
},
{
"kind": "container",
"id": "worker",
"name": "Booking Worker",
"description": "Async worker processing events.",
"systemId": "booking-system",
"technologyBucket": "service",
"technology": "Bun + PostgreSQL 15",
"tags": ["backend", "async"],
"position": {
"x": 500,
"y": 200
}
},
{
"kind": "container-db",
"id": "primary-db",
"name": "Primary Database",
"description": "PostgreSQL primary.",
"systemId": "booking-system",
"technologyBucket": "database",
"technology": "PostgreSQL 15",
"tags": ["data"],
"position": {
"x": 800,
"y": 0
}
},
{
"kind": "container",
"id": "bus",
"name": "Message Bus",
"description": "Event bus for async fan-out.",
"systemId": "booking-system",
"technologyBucket": "message-bus",
"technology": "NATS JetStream",
"tags": ["infra", "events"],
"position": {
"x": 500,
"y": 400
}
}
],
"components": [],
"relationships": [
{
"kind": "relationship",
"id": "r-spa-api",
"sourceId": "spa",
"targetId": "api",
"type": "calls",
"protocol": "HTTPS/JSON",
"description": "REST + GraphQL over HTTPS."
},
{
"kind": "relationship",
"id": "r-api-db",
"sourceId": "api",
"targetId": "primary-db",
"type": "reads-from",
"label": "Reads/writes bookings",
"protocol": "JDBC"
},
{
"kind": "relationship",
"id": "r-api-bus",
"sourceId": "api",
"targetId": "bus",
"type": "publishes-event",
"label": "Emits BookingConfirmed",
"protocol": "NATS"
},
{
"kind": "relationship",
"id": "r-worker-bus",
"sourceId": "worker",
"targetId": "bus",
"type": "subscribes-to",
"label": "Listens for BookingConfirmed"
},
{
"kind": "relationship",
"id": "r-worker-db",
"sourceId": "worker",
"targetId": "primary-db",
"type": "writes-to",
"protocol": "JDBC"
},
{
"kind": "relationship",
"id": "r-traveler-spa",
"sourceId": "traveler",
"targetId": "spa",
"type": "uses",
"protocol": "HTTPS"
}
],
"invariants": [
{
"kind": "invariant",
"id": "inv-no-spa-db",
"name": "No direct DB access from the SPA",
"expression": "no edge(spa -> primary-db)",
"involvedElements": ["spa", "primary-db"],
"severity": "error",
"category": "security"
},
{
"kind": "invariant",
"id": "inv-worker-events",
"name": "Worker must consume events, not call APIs",
"expression": "worker.in == bus",
"involvedElements": ["worker"],
"severity": "warning",
"category": "resilience"
}
]
}
↓ download
demo-03-component-level.c4.json — Context Studio canvas view

Demo 3 — C4 Component level: drill-down into the Booking API container. Exercises container + component (with containerId) nodes, plus relationships between components.

demo-03-component-level.c4.json — Demo 3 — C4 Component level: drill-down into the Booking API container. Exercises container + component (with containerId) nodes, plus relationships between components. (expand for full JSON)
demo-03-component-level.c4.json
{
"kind": "c4-file",
"schemaVersion": "0.3.0",
"persons": [],
"softwareSystems": [
{
"kind": "software-system",
"id": "booking-system",
"name": "Travel Booking System",
"isScope": true,
"tags": ["scope"]
}
],
"containers": [
{
"kind": "container",
"id": "api",
"name": "Booking API",
"systemId": "booking-system",
"technologyBucket": "api",
"technology": "SvelteKit 2"
}
],
"components": [
{
"kind": "component",
"id": "comp-ctrl-booking",
"name": "BookingController",
"description": "REST routes for bookings.",
"containerId": "api",
"technology": "SvelteKit endpoints",
"tags": ["public-api"],
"position": {
"x": 0,
"y": 0
}
},
{
"kind": "component",
"id": "comp-svc-pricing",
"name": "PricingService",
"description": "Computes fares and discounts.",
"containerId": "api",
"technology": "TypeScript",
"tags": ["domain"],
"position": {
"x": 200,
"y": 0
}
},
{
"kind": "component",
"id": "comp-repo-booking",
"name": "BookingRepository",
"description": "Postgres-backed bookings store.",
"containerId": "api",
"technology": "Drizzle ORM",
"tags": ["data"],
"position": {
"x": 400,
"y": 0
}
},
{
"kind": "component",
"id": "comp-validator",
"name": "BookingValidator",
"description": "Validates booking domain rules.",
"containerId": "api",
"technology": "TypeScript",
"tags": ["domain"],
"position": {
"x": 200,
"y": 200
}
}
],
"relationships": [
{
"kind": "relationship",
"id": "r-ctrl-validator",
"sourceId": "comp-ctrl-booking",
"targetId": "comp-validator",
"type": "calls",
"label": "Validates booking"
},
{
"kind": "relationship",
"id": "r-ctrl-pricing",
"sourceId": "comp-ctrl-booking",
"targetId": "comp-svc-pricing",
"type": "calls",
"label": "Computes price"
},
{
"kind": "relationship",
"id": "r-ctrl-repo",
"sourceId": "comp-ctrl-booking",
"targetId": "comp-repo-booking",
"type": "calls",
"label": "Persists booking"
},
{
"kind": "relationship",
"id": "r-validator-pricing",
"sourceId": "comp-validator",
"targetId": "comp-svc-pricing",
"type": "uses",
"label": "Price-aware validation"
}
],
"invariants": []
}
↓ download
demo-04-groups-and-views.c4.json — Context Studio canvas view

Demo 4 — C4 groups + views: named element groupings and tag-filtered named views (security view excludes frontend). Exercises C4Group, C4View, cross-model externalId links, and regenerated provenance.

demo-04-groups-and-views.c4.json — Demo 4 — C4 groups + views: named element groupings and tag-filtered named views (security view excludes frontend). Exercises C4Group, C4View, cross-model externalId links, and regenerated provenance. (expand for full JSON)
demo-04-groups-and-views.c4.json
{
"kind": "c4-file",
"schemaVersion": "0.3.0",
"persons": [
{
"kind": "person",
"id": "traveler",
"name": "Traveler",
"externalId": "usm:persona:traveler",
"tags": ["external"]
}
],
"softwareSystems": [
{
"kind": "software-system",
"id": "booking-system",
"name": "Travel Booking System",
"isScope": true,
"tags": ["scope"],
"externalId": "ddd:domain:booking"
}
],
"containers": [
{
"kind": "container",
"id": "spa",
"name": "Web SPA",
"systemId": "booking-system",
"technologyBucket": "spa",
"tags": ["frontend", "public"]
},
{
"kind": "container",
"id": "api",
"name": "Booking API",
"systemId": "booking-system",
"technologyBucket": "api",
"tags": ["backend"]
},
{
"kind": "container-db",
"id": "primary-db",
"name": "Primary Database",
"systemId": "booking-system",
"technologyBucket": "database",
"tags": ["data"]
}
],
"components": [],
"relationships": [
{
"kind": "relationship",
"id": "r-spa-api",
"sourceId": "spa",
"targetId": "api",
"type": "calls"
},
{
"kind": "relationship",
"id": "r-api-db",
"sourceId": "api",
"targetId": "primary-db",
"type": "reads-from"
}
],
"invariants": [
{
"kind": "invariant",
"id": "inv-no-direct-db",
"name": "No direct DB access from the SPA",
"expression": "no edge(spa -> primary-db)",
"involvedElements": ["spa", "primary-db"],
"severity": "error",
"category": "security"
}
],
"groups": [
{
"kind": "group",
"id": "g-frontend",
"name": "Frontend Boundary",
"elementIds": ["spa", "traveler"]
},
{
"kind": "group",
"id": "g-internal",
"name": "Internal Boundary",
"elementIds": ["api", "primary-db"]
}
],
"views": [
{
"kind": "view",
"key": "security",
"title": "Security View",
"level": "container",
"includeTags": ["backend", "data", "frontend"],
"isDefault": true
},
{
"kind": "view",
"key": "backend-only",
"title": "Backend Only",
"level": "container",
"excludeTags": ["frontend", "public"]
},
{
"kind": "view",
"key": "system-context",
"title": "System Context",
"level": "context",
"includeTags": ["scope", "external"]
}
],
"regeneratedAt": "2026-09-14T09:00:00.000Z",
"regeneratedFrom": "ddd+dsm+scm+sim"
}
↓ download
demo-05-deployment-and-styles.c4.json — Context Studio canvas view

Demo 5 — C4 0.4.0 Structurizr parity: deployment environments (nodes, infrastructure, instances, health checks), tag-matched styles + theme, implied relationships, and the authored view kinds (animated filtered view, dynamic, deployment, custom). Round-trips through the Structurizr DSL exporter/importer.

demo-05-deployment-and-styles.c4.json — Demo 5 — C4 0.4.0 Structurizr parity: deployment environments (nodes, infrastructure, instances, health checks), tag-matched styles + theme, implied relationships, and the authored view kinds (animated filtered view, dynamic, deployment, custom). Round-trips through the Structurizr DSL exporter/importer. (expand for full JSON)
demo-05-deployment-and-styles.c4.json
{
"kind": "c4-file",
"schemaVersion": "0.4.0",
"persons": [
{
"kind": "person",
"id": "admin",
"name": "Platform Admin",
"description": "Operates the deployment.",
"tags": ["internal", "ops"]
}
],
"softwareSystems": [
{
"kind": "software-system",
"id": "orders",
"name": "Orders Platform",
"isScope": true,
"description": "The system under design.",
"tags": ["scope"]
},
{
"kind": "software-system",
"id": "payments",
"name": "Payments Provider",
"description": "External PSP.",
"tags": ["external"]
}
],
"containers": [
{
"kind": "container",
"id": "api",
"name": "Orders API",
"systemId": "orders",
"technology": "NestJS",
"technologyBucket": "api",
"tags": ["service", "critical"]
},
{
"kind": "container-db",
"id": "db",
"name": "Orders DB",
"systemId": "orders",
"technology": "PostgreSQL 16",
"technologyBucket": "database",
"tags": ["data"]
},
{
"kind": "container",
"id": "worker",
"name": "Fulfilment Worker",
"systemId": "orders",
"technology": "BullMQ",
"technologyBucket": "function",
"tags": ["service"]
}
],
"components": [
{
"kind": "component",
"id": "pricing",
"name": "Pricing Engine",
"containerId": "api",
"technology": "module"
}
],
"relationships": [
{
"kind": "relationship",
"id": "r1",
"sourceId": "admin",
"targetId": "api",
"type": "uses",
"protocol": "HTTPS",
"tags": ["critical"],
"properties": {
"sla": "99.95%"
},
"url": "https://docs.example.com/admin-api"
},
{
"kind": "relationship",
"id": "r2",
"sourceId": "api",
"targetId": "payments",
"type": "calls",
"protocol": "HTTPS/REST",
"description": "Charges cards.",
"tags": ["critical"]
},
{
"kind": "relationship",
"id": "r3",
"sourceId": "pricing",
"targetId": "db",
"type": "reads-from",
"protocol": "SQL"
},
{
"kind": "relationship",
"id": "r4",
"sourceId": "api",
"targetId": "worker",
"type": "publishes-event",
"protocol": "BullMQ"
}
],
"invariants": [],
"deploymentEnvironments": [
{
"kind": "deployment-environment",
"id": "env-production",
"name": "Production",
"description": "Customer-facing live estate.",
"deploymentNodes": [
{
"kind": "deployment-node",
"id": "edge",
"name": "Edge",
"technology": "CDN",
"children": [],
"infrastructureNodes": [
{
"kind": "infrastructure-node",
"id": "lb",
"name": "Load Balancer",
"technology": "nginx",
"tags": ["critical"]
}
],
"softwareSystemInstances": [],
"containerInstances": []
},
{
"kind": "deployment-node",
"id": "cluster",
"name": "App Cluster",
"technology": "Kubernetes",
"instances": 3,
"children": [],
"infrastructureNodes": [],
"softwareSystemInstances": [
{
"kind": "software-system-instance",
"id": "orders-1",
"softwareSystemId": "orders",
"instanceNumber": 1,
"healthChecks": [
{
"id": "hc-orders",
"name": "orders ping",
"url": "https://orders.example.com/health",
"interval": 30,
"timeout": 5
}
]
}
],
"containerInstances": [
{
"kind": "container-instance",
"id": "api-1",
"containerId": "api",
"instanceNumber": 1,
"deploymentGroups": ["eu"]
},
{
"kind": "container-instance",
"id": "db-1",
"containerId": "db",
"instanceNumber": 1
}
]
}
]
}
],
"styles": {
"theme": "default",
"elements": [
{
"tag": "critical",
"stroke": "#ef4444",
"border": "dashed"
},
{
"tag": "data",
"background": "#22c55e",
"shape": "cylinder"
}
],
"relationships": [
{
"tag": "critical",
"color": "#ef4444",
"thickness": 3,
"style": "dashed"
}
]
},
"impliedRelationships": true,
"views": [
{
"kind": "view",
"key": "services",
"title": "Services only",
"level": "container",
"includeTags": ["service"],
"animation": [
{
"order": 1,
"elementIds": ["api"]
},
{
"order": 2,
"elementIds": ["worker"]
}
]
},
{
"kind": "dynamic-view",
"key": "charge-flow",
"title": "Card charge flow",
"scopeId": "orders",
"steps": [
{
"order": 1,
"relationshipId": "r3"
},
{
"order": 2,
"relationshipId": "r2"
},
{
"order": 3,
"sourceId": "worker",
"targetId": "db",
"label": "persists results"
}
]
},
{
"kind": "deployment-view",
"key": "prod",
"title": "Production estate",
"environment": "Production",
"isDefault": true
},
{
"kind": "custom-view",
"key": "pricing-slice",
"title": "Pricing slice",
"elementIds": ["pricing", "db", "api"],
"relationshipIds": ["r3"]
}
]
}

The c4 model is one of the richly-curated records — every downstream surface (CLI, MCP, docs, tests) reads from one record. The pasteable snippet below is the Door 1 anchor a downstream agent should see before touching this model.

paste into AGENTS.md / CLAUDE.md
- **C4 v0.5.0** — `models/c4.json`.
Produces: Mermaid C4 diagrams, Structurizr DSL, C4-PlantUML, and a claude-md architecture section.
Oracle: diagrams are generated, never hand-drawn — code-vs-diagram drift is a generation gap, not an opinion.
Downstream: `ctxbrew semantics c4` · `ctxbrew://semantics/c4/v0.5.0` — read the record first.

The full record (every door — anchor template, tool description hint, response annotations, behavior tripwire, and the complete produced-surface list) is served as JSON at:

  • CLI — ctxbrew semantics c4 --schema-version 0.5.0
  • MCP — ctxbrew://semantics/c4/v0.5.0
  • HTTP — https://contextbrew.dev/schemas/c4/v0.5/semantics.json

See the schemas overview for the versioning policy and how these files are generated and kept in sync.