{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "お問い合わせフォーム システム構成案",
    "quality_profile": "showcase",
    "viewBox": [
      1360,
      650
    ]
  },
  "components": [
    {
      "id": "visitor",
      "type": "frontend",
      "label": "利用者のブラウザー",
      "sublabel": "入力・確認・送信",
      "pos": [
        31.0,
        280
      ],
      "size": [
        187.0,
        88
      ]
    },
    {
      "id": "static-site",
      "type": "external",
      "label": "さくらVPS",
      "sublabel": "nginx / Astro 静的サイト",
      "tag": "既存環境を継続",
      "pos": [
        31.0,
        80
      ],
      "size": [
        187.0,
        88
      ]
    },
    {
      "id": "contact-api",
      "type": "cloud",
      "label": "API Gateway",
      "sublabel": "HTTP API / POST受付",
      "tag": "CORS・スロットリング",
      "pos": [
        312.0,
        280
      ],
      "size": [
        187.0,
        88
      ],
      "brand": "amazon-api-gateway"
    },
    {
      "id": "mail-handler",
      "type": "backend",
      "label": "AWS Lambda",
      "sublabel": "検証・件数判定・メール送信",
      "tag": "同時実行数を制限",
      "pos": [
        624.0,
        280
      ],
      "size": [
        203.0,
        88
      ],
      "brand": "aws-lambda"
    },
    {
      "id": "smtp-host",
      "type": "external",
      "label": "さくらレンタルサーバー",
      "sublabel": "SMTP認証 / TLS必須",
      "tag": "既存環境を継続",
      "pos": [
        1014.0,
        280
      ],
      "size": [
        218.0,
        88
      ]
    },
    {
      "id": "contact-mailbox",
      "type": "external",
      "label": "指定の受信メールアドレス",
      "sublabel": "宛先固定 / 自動返信なし",
      "pos": [
        1014.0,
        480
      ],
      "size": [
        218.0,
        88
      ]
    },
    {
      "id": "bot-check",
      "type": "security",
      "label": "Cloudflare Turnstile",
      "sublabel": "Siteverify / トークン検証",
      "pos": [
        1014.0,
        80
      ],
      "size": [
        218.0,
        88
      ],
      "brand": "cloudflare"
    },
    {
      "id": "credential-store",
      "type": "security",
      "label": "Secrets Manager",
      "sublabel": "SMTP認証情報・秘密鍵",
      "pos": [
        312.0,
        80
      ],
      "size": [
        187.0,
        88
      ],
      "brand": "aws-secrets-manager"
    },
    {
      "id": "send-limits",
      "type": "database",
      "label": "DynamoDB",
      "sublabel": "時間・日単位の送信枠",
      "tag": "条件付き更新で上限管理",
      "pos": [
        624.0,
        80
      ],
      "size": [
        203.0,
        88
      ],
      "brand": "amazon-dynamodb"
    },
    {
      "id": "operations",
      "type": "cloud",
      "label": "CloudWatch",
      "sublabel": "ログ・エラー監視・アラーム",
      "pos": [
        624.0,
        480
      ],
      "size": [
        203.0,
        88
      ],
      "brand": "amazon-cloudwatch"
    },
    {
      "id": "operator-alert",
      "type": "messagebus",
      "label": "Amazon SNS",
      "sublabel": "管理者への異常通知",
      "pos": [
        312.0,
        480
      ],
      "size": [
        187.0,
        88
      ],
      "brand": "amazon-sns"
    }
  ],
  "boundaries": [
    {
      "kind": "region",
      "label": "AWS / 東京リージョン（想定）",
      "wraps": [
        "contact-api",
        "mail-handler",
        "credential-store",
        "send-limits",
        "operations",
        "operator-alert"
      ],
      "pad": 36
    }
  ],
  "connections": [
    {
      "id": "load-page",
      "from": "visitor",
      "to": "static-site",
      "label": "HTTPS / 画面取得",
      "fromSide": "top",
      "toSide": "bottom"
    },
    {
      "id": "submit-contact",
      "from": "visitor",
      "to": "contact-api",
      "label": "HTTPS POST",
      "variant": "emphasis"
    },
    {
      "id": "invoke-handler",
      "from": "contact-api",
      "to": "mail-handler",
      "label": "同期呼び出し",
      "variant": "emphasis"
    },
    {
      "id": "deliver-smtp",
      "from": "mail-handler",
      "to": "smtp-host",
      "label": "587 STARTTLS / 465 TLS",
      "variant": "emphasis"
    },
    {
      "id": "deliver-mailbox",
      "from": "smtp-host",
      "to": "contact-mailbox",
      "label": "メール配送",
      "fromSide": "bottom",
      "toSide": "top",
      "variant": "emphasis",
      "labelDy": 80
    },
    {
      "id": "verify-turnstile",
      "from": "mail-handler",
      "to": "bot-check",
      "label": "HTTPS / 検証",
      "variant": "security",
      "fromSide": "right",
      "toSide": "bottom"
    },
    {
      "id": "reserve-send-slot",
      "from": "mail-handler",
      "to": "send-limits",
      "label": "送信枠の確保",
      "fromSide": "top",
      "toSide": "bottom"
    },
    {
      "id": "read-secrets",
      "from": "mail-handler",
      "to": "credential-store",
      "label": "秘密情報の取得",
      "variant": "security",
      "fromSide": "left",
      "toSide": "bottom"
    },
    {
      "id": "record-result",
      "from": "mail-handler",
      "to": "operations",
      "label": "処理結果・メトリクス",
      "variant": "dashed",
      "fromSide": "bottom",
      "toSide": "top",
      "labelDy": 80
    },
    {
      "id": "notify-operator",
      "from": "operations",
      "to": "operator-alert",
      "label": "異常時に通知",
      "variant": "dashed"
    }
  ],
  "cards": [
    {
      "dot": "cyan",
      "title": "受付から送信まで",
      "items": [
        "入力・Turnstile検証後に送信枠を確保",
        "SMTP受付成功後に画面へ成功を返す"
      ]
    },
    {
      "dot": "emerald",
      "title": "送信の制御",
      "items": [
        "宛先・From固定 / 投稿者はReply-To",
        "上限到達・検証失敗時は送信しない"
      ]
    },
    {
      "dot": "amber",
      "title": "運用・権限",
      "items": [
        "IAMで最小権限 / ログに本文を残さない",
        "独自VPC・NAT Gateway・SESは使用しない"
      ]
    }
  ]
}
