---
code: "SCH-29"
id: "c-sch-arch"
tab: "schemas"
kind: "schema"
title: "Layered Arch · 시스템 계층"
library: "SVG"
deps: ["svg"]
load: "low"
pasteKind: "schema-svg"
family: "stack"
dataShape: "4-cell diagram with 계층 누적 axis"
tasks: ["structure ideas", "explain process", "choose communication frame"]
tags: ["stack", "계층 누적", "4cells", "Architecture", "MSA", "계층", "시스템"]
gallery: "https://graph.heal7.com/#SCH-29"
js: "/sku/SCH-29.js"
---

# [SCH-29] Layered Arch · 시스템 계층

> AI 붙여넣기 카드. 갤러리 런타임(`main.js`)이 아니라 이 파일을 가져와라.

## 언제 가져가나
Frontend → API → Service → DB 4계층 stack — 시스템 아키텍처 표준 표현.

**응용** 시스템 아키텍처, MSA 계층, 의존성 매핑, 배포 다이어그램.

## 데이터 모양
- family: `stack`
- dataShape: 4-cell diagram with 계층 누적 axis
- tasks: structure ideas, explain process, choose communication frame
- tags: stack, 계층 누적, 4cells, Architecture, MSA, 계층, 시스템

- schema.type: `stack`
- schema.cells: `4`
- schema.axis: `계층 누적`


## 의존
svg · load `low` · library `SVG`

## 붙여넣는 법
1. 라이브러리 없음. svg viewBox 0 0 400 240
2. 아래 body 를 svg 안에 넣는다
3. 색 변수(`${gold}` 등)는 T 토큰으로 치환한다

```js
const T = {
  "bg": "transparent",
  "fg": "#ece8f5",
  "sub": "#a59bbd",
  "grid": "rgba(255,255,255,.08)",
  "gold": "#e8c069",
  "royal": "#6b8cff",
  "rose": "#e07a9f",
  "teal": "#6dd2c4",
  "plum": "#b487e8"
};
const gold = T.gold, royal = T.royal, rose = T.rose, teal = T.teal, plum = T.plum, fg = T.fg, sub = T.sub;
const stroke = 'rgba(255,255,255,.18)';
const fill1 = 'rgba(232,192,105,.10)';
const fill2 = 'rgba(107,140,255,.10)';
const host = document.querySelector('#chart');
const body = `
    ${[
      ['Frontend (UI)',  gold,  '브라우저 / 모바일'],
      ['API Gateway',    royal, 'REST / GraphQL'],
      ['Service Layer',  plum,  '비즈니스 로직'],
      ['Data Layer',     rose,  'DB / Cache']
    ].map(([lab,c,desc],i)=>{
      const y = 28 + i*48;
      return `<rect x="40" y="${y}" width="320" height="40" rx="6" fill="${fill1}" stroke="${c}" stroke-width="1.5"/>
              <text x="60" y="${y+18}" fill="${c}" font-size="12" font-weight="700">${lab}</text>
              <text x="60" y="${y+33}" fill="${sub}" font-size="10">${desc}</text>
              ${i<3 ? `<path d="M 200 ${y+44} L 200 ${y+50} M 196 ${y+46} L 200 ${y+50} L 204 ${y+46}" fill="none" stroke="${stroke}" stroke-width="1.2"/>` : ''}`;
    }).join('')}
  `;
host.innerHTML = '<svg viewBox="0 0 400 240" width="100%" height="100%" preserveAspectRatio="xMidYMid meet" style="overflow:visible">' + (typeof body === 'string' ? body : '') + '</svg>';
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 3911-4470
- gallery: https://graph.heal7.com/#SCH-29
- raw js: https://graph.heal7.com/sku/SCH-29.js

```js
`
    ${[
      ['Frontend (UI)',  gold,  '브라우저 / 모바일'],
      ['API Gateway',    royal, 'REST / GraphQL'],
      ['Service Layer',  plum,  '비즈니스 로직'],
      ['Data Layer',     rose,  'DB / Cache']
    ].map(([lab,c,desc],i)=>{
      const y = 28 + i*48;
      return `<rect x="40" y="${y}" width="320" height="40" rx="6" fill="${fill1}" stroke="${c}" stroke-width="1.5"/>
              <text x="60" y="${y+18}" fill="${c}" font-size="12" font-weight="700">${lab}</text>
              <text x="60" y="${y+33}" fill="${sub}" font-size="10">${desc}</text>
              ${i<3 ? `<path d="M 200 ${y+44} L 200 ${y+50} M 196 ${y+46} L 200 ${y+50} L 204 ${y+46}" fill="none" stroke="${stroke}" stroke-width="1.2"/>` : ''}`;
    }).join('')}
  `
```

## 시나리오
- 시스템 아키텍처 다이어그램
- MSA 계층
- 의존성 매핑
- 배포 다이어그램

## 관련 SKU
`c-sch-pyramid`, `c-sch-onion`

