Skip to content

Language reference

GitHub →

An architecture is written in *.ayida.hcl files with exactly one project block. There is no ayida.toml, no markdown frontmatter model, and no hand-written D2. Run ayida validate after every change; ayida fmt restores canonical formatting.

Element kinds

C4 conceptayida blockParent attributeExample
Person (user, actor)personnonea customer, an operator
Software system (yours)systemnone“Payments”
External systemexternalnonea card processor, an email provider
Container (deployable/runnable unit, data store)containersystem = system.<name> (required)API, SPA, database, queue
Component (grouping inside a container)componentcontainer = container.<name> (required)handler, repository
Deploymentdeployment with nested node and instanceof = <element> on an instanceprod environment

Level 4 (code) is out of scope: leave it to the IDE.

Addresses are kind.name (container.api). Names are unique per kind across the whole project, not per parent, so container.api in two systems is a duplicate_declaration error: name them orders_api and billing_api, and use title for the display name.

Complete example

A full, compilable configuration demonstrating every block type — it validates with no errors:

project "acme-payments" {
  description  = "Payment processing platform"
  ayida_version = "~> 2.0"
}

locals {
  team = "platform"
}

person "customer" {
  description = "Buys things"
  docs        = "./docs/customer.md"

  uses "checkout" {
    target      = container.api
    description = "Places an order"
  }
}

system "payments" {
  description = "Authorization, capture, settlement"
  owner       = local.team
  docs        = "./docs/payments.md"
  tags        = ["pci"]
}

container "api" {
  system     = system.payments
  technology = "AWS Lambda (Go)"
  docs       = "./docs/api.md"
  tags       = ["public", "pci"]

  uses "orders" {
    target      = container.orders_db
    description = "Reads and writes orders"
    technology  = "PostgreSQL wire protocol"
  }

  uses "cards" {
    target      = external.stripe
    description = "Authorizes and captures card payments"
  }
}

container "orders_db" {
  system     = system.payments
  technology = "Aurora PostgreSQL"
  docs       = "./docs/db.md"
  tags       = ["pci"]
}

component "handler" {
  container   = container.api
  description = "HTTP entry point"
  docs        = "./docs/handler.md"

  uses "store" {
    target      = container.orders_db
    description = "Persists the order"
  }
}

external "stripe" {
  description = "Card processing"
  docs        = "./docs/stripe.md"
}

deployment "prod" {
  provider = "aws"
  account  = "123456789012"
  region   = "us-east-1"

  node "vpc-main" {
    node "subnet-a" {
      instance "api" {
        of         = container.api
        attributes = { memory = 1024, timeout = 30 }

        binding "terraform" {
          address = "module.api.aws_lambda_function.this"
        }
      }
    }
  }
}

view "payment-path" {
  include = [system.payments, container.api]
  exclude = [container.orders_db]
}

reconcile {
  ignore = ["aws_iam_role_policy_attachment.*"]
}

Blocks and attributes

project

Defines the project and the compiler version constraint.

project "acme-payments" {
  description     = "Payment processing platform"
  ayida_version   = "~> 2.0"
  footer          = "© Acme Payments — internal architecture"
  layout          = "elk"
  outside         = "expanded"
  ignore_warnings = ["missing_docs"]
}
AttributeTypePurpose
descriptionstringShown on the site index
ayida_versionstring constraintAccepts =, !=, >, >=, <, <=, ~>, and comma-separated conjunctions (">= 2.0, < 3.0"). An unsatisfied constraint is a version_unsatisfied error
footerstringPlain text shown in the site footer
layout"elk" or "dagre"The layout engine for every diagram that sets none. elk is the default: it routes edges at right angles and keeps labels readable. dagre lays out about 4 times faster, which helps on very large models
outside"expanded" or "collapsed"How deployment views draw a link to an element with no instance in the environment. expanded (default) draws one node per outside element; collapsed draws one shared “outside this view” node
ignore_warningslist(string)Warning and information codes to leave out of every run, --strict included. An error code here is an invalid_attribute_value error

locals

Names for reuse in expressions, referenced as local.<name> (see owner = local.team above).

person, system, external

Top-level logical elements with description, docs, tags, and (for system) owner.

container

Belongs to a system via the required system attribute. Common attributes: title, technology, shape (database, queue, topic, function or bucket), docs, tags.

component

Groups code inside a container via the required container attribute.

uses (relationships)

Relationships nest inside their source element. A uses "orders" inside container "api" has the stable address container.api.uses.orders. Attributes: target (a typed reference such as container.db, never a quoted string), description, technology, and kind (sync, async, trigger). kind changes how a relationship is drawn, never what depends on what.

deployment, node, instance

The deployment plane instantiates the logical plane per environment. deployment carries provider, account, region, and an optional outside that wins over the project’s. node blocks nest to any depth (for example VPC → subnet) and can carry title, technology, description and tags. They do not contribute to instance addresses, so instance names are unique per deployment. instance has of (the element it instantiates), free-form attributes, an optional technology (overriding the element’s on this deployment’s diagram), planned (set true for infrastructure not built yet, to suppress unbound_instance), and binding blocks binding it to real infrastructure such as Terraform or CloudFormation addresses.

view

Selects elements by reference or tag for a focused diagram, with optional exclude:

view "payment-path" {
  title       = "Payment path"
  description = "How a charge flows through the platform"
  include     = [system.payments, container.api]
  exclude     = [container.orders_db]
  direction   = "right"   # "down" (default) or "right"
  layout      = "elk"     # "elk" (default) or "dagre"
}

Every system and container with children gets a diagram automatically; declared view blocks add focused pictures. The reserved names landscape, system-<name>, container-<name> and deployment-<environment> replace the view the compiler derives automatically, reported as view_shadowed. A view that selects nothing warns with view_empty.

Dynamic views

A view with step blocks is a dynamic view: an ordered flow through the model. Each step names from and to elements, an optional via, a description, and reply = true to match a relationship drawn in reverse. Steps are numbered by position and checked against the declared relationships. view.style is edges (numbered edges, the default) or sequence (a sequence diagram); both list the steps in a table on the view’s page.

view "checkout" {
  title = "Checkout flow"
  style = "sequence"

  step "submit order" {
    from        = container.api
    to          = container.orders_db
    description = "Persists the order"
  }

  step "queue settlement" {
    from = container.api
    to   = container.settlements
  }
}

A step that matches no relationship is a step_mismatch error; a view that both declares steps and selects (or sets style without steps) is a dynamic_view_selection error. Query the flows an element takes part in with ayida query flows <address>.

docs and prose

docs = "./docs/api.md" attaches markdown to an element; it appears on the element’s site page, so prose lives beside the model. Paths resolve from the file that declares them, with the project root as a fallback, so a relationship between prose and model survives a file being moved.

moved

A moved { from = …, to = … } block records a rename so an element’s history survives it. The MCP move tool and apply_edit rename operation append one automatically; you rarely write it by hand. ayida diff reads moved blocks, so a rename shows as one renamed change rather than a removed element and an added one.

reconcile

Declares ignore patterns for future reconciliation against infrastructure sources.

References

References are bare traversals (container.api, system.payments), resolved and type-checked at compile time. A typo is an error with a file, line and column, usually with a suggestion:

Error: Unresolvable reference
  on arch.ayida.hcl:28:19:
  28 |     target      = container.ordrs_db
                         ^^^^^^^^^^^^^^^^^^
  No element "container.ordrs_db" is declared. Did you mean
  container.orders_db?