# Build architecture with AI

> How an AI assistant builds and edits Arc-Tech architecture designs over MCP, with working JSON for components, connections and environments.

Source: https://arc-tech.dev/docs/build-architecture

Create the design, fill it in one `edit_design` call, then look at it.

## 1. Create it

```json create_design
{
  "project_id": "<project id>",
  "kind": "architecture",
  "name": "Telemetry platform",
  "reason": "Started the architecture for the telemetry platform"
}
```

It starts with three environments, whose ids are `env-dev`, `env-staging` and `env-production`.

## 2. Fill it in one call

Place components in columns from left (entry points) to right (data), about 280 apart. A group's members use positions inside the group.

```json edit_design
{
  "design_id": "<design id>",
  "add_nodes": [
    { "id": "sensors", "type": "custom", "name": "Sensor nodes", "position": { "x": 0, "y": 120 },
      "properties": { "description": "Temperature and humidity, every 60 s", "status": "active" } },
    { "id": "broker", "type": "pubsub", "name": "MQTT broker", "position": { "x": 320, "y": 120 },
      "properties": { "provider": "MQTT", "status": "active" } },
    { "id": "processor", "type": "worker", "name": "Stream processor", "position": { "x": 640, "y": 120 },
      "properties": { "runtime": "Python 3.12", "replicas": 8, "status": "active" },
      "environments": { "env-dev": { "overrides": { "replicas": 1 } } } },
    { "id": "db", "type": "postgres", "name": "Telemetry database", "position": { "x": 960, "y": 40 },
      "properties": { "engine": "PostgreSQL", "version": "16", "port": 5432, "status": "active" } },
    { "id": "alerts", "type": "queue", "name": "Alert queue", "position": { "x": 960, "y": 220 },
      "properties": { "status": "draft" },
      "environments": { "env-dev": { "enabled": false } } }
  ],
  "add_edges": [
    { "id": "e1", "source": "sensors", "target": "broker", "relationshipType": "publishes_to", "label": "MQTT" },
    { "id": "e2", "source": "processor", "target": "broker", "relationshipType": "consumes_from" },
    { "id": "e3", "source": "processor", "target": "db", "relationshipType": "writes_to" },
    { "id": "e4", "source": "processor", "target": "alerts", "relationshipType": "publishes_to" }
  ],
  "reason": "Added the ingest path, from the sensors to storage and alerts"
}
```

In `edit_design`, a component's `environments` are keyed by **environment id**, with `overrides` and `enabled`.

## 3. Look at it

Call `render_design`. Check that nothing overlaps, every component is connected, and names are readable. Then render each environment by passing `environment`.

## Changing what's there

- **One property in one environment**: `update_component` with `environment`, by name or id. Setting a property to `null` there goes back to the base value.
- **Moving and resizing**: `edit_design` with `update_nodes`. Send only the `id` and what changes.
- **Removing**: `remove_node_ids`. Its connections go too. A removed group's members stay.

`create_component` takes `environments` by name or id, with `properties` instead of `overrides`. It's easier for a single component.

## Property keys

```text
Component properties by key, as the app shows them: dns domain, provider, ttl, nameservers, records [{id, type, name, value, ttl, priority}]; vm hostname, publicIp, privateIp, sshUser, sshPort, os, provider, region, instanceType, cpu, ramGb, diskGb; services url, protocol, port, healthCheckPath, runtime, replicas; databases provider, engine, version, host, port, databaseName; queues provider, queueName; storage provider, bucketName, region, accessLevel; plus description, tags, owner and status (draft, active, warning or deprecated) on any component. Never put passwords, keys or tokens in properties.
```
