flowchart LR
%% --- 디자인 시스템 ---
classDef pink fill:#FFCDD2,stroke:none,color:#D32F2F,rx:20,ry:20,font-weight:bold
classDef ssl fill:#E1F5FE,stroke:#0288D1,stroke-width:2px,color:#01579B,rx:20,ry:20,font-style:italic
classDef docker fill:#E1F5FE,stroke:#0277BD,stroke-width:2px,color:#01579B,rx:10,ry:10
classDef coral fill:#FF8A80,stroke:none,color:white,rx:20,ry:20,font-weight:bold
classDef ai fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px,color:#1B5E20,rx:20,ry:20,font-weight:bold
classDef plain fill:none,stroke:none,color:#5D4037,font-weight:bold
User("👤 User"):::plain
subgraph FE_Layer ["🌐 Frontend Edge"]
Firebase("🔥 Firebase Hosting<br/>(Static Assets / Proxy)"):::pink
end
subgraph AWS_EC2 ["☁️ AWS Hardened Host (Docker Engine)"]
direction TB
%% Ingress Proxy
subgraph Ingress ["🔒 Security Ingress"]
Nginx_Proxy("🐳 Docker: Nginx<br/>(Reverse Proxy / SSL)"):::docker
Cert_Bot("🔒 Certbot Sidecar"):::ssl
end
%% Application Mesh
subgraph Docker_VNet ["🐳 Isolated Docker Network (Bridge)"]
direction LR
Node_App("🧩 Container: Node.js API"):::coral
subgraph AI_Pipeline ["🤖 AI Logic"]
AI_Handler("📡 OpenAI Agent"):::ai
end
end
%% Persistence Layer
subgraph Storage ["💾 Persistence"]
direction LR
DB[("🐬 MySQL 8.0")]:::coral
Redis[("🔴 Redis 7.0")]:::coral
end
end
External_AI[("🧠 OpenAI API")]:::ai
%% --- 데이터 흐름 ---
User -- "HTTPS Request" --> Firebase
Firebase == "Secure Tunnel" ==> Nginx_Proxy
Nginx_Proxy -- "Forward (L7)" --> Node_App
Node_App <--> AI_Handler
AI_Handler -. "External Call" .-> External_AI
Node_App <--> DB
Node_App <--> Redis
%% --- 스타일 적용 ---
linkStyle 1,2 stroke:#0288d1,stroke-width:3px
linkStyle 4,5,6 stroke:#2E7D32,stroke-width:2px,stroke-dasharray: 4 4
linkStyle default stroke:#FF8A80,stroke-width:2px,fill:none