172 lines
5.8 KiB
Plaintext
172 lines
5.8 KiB
Plaintext
!theme mono
|
|
|
|
skinparam componentStyle rectangle
|
|
skinparam componentFontSize 12
|
|
skinparam arrowFontSize 11
|
|
skinparam arrowThickness 2
|
|
|
|
title HealthSync 역설계 논리 아키텍처 (개발 소스 기반)
|
|
|
|
' 클라이언트 (Backends for Frontends 패턴)
|
|
package "클라이언트 계층" #lightcyan {
|
|
[React 모바일 웹앱] as MobileApp
|
|
}
|
|
|
|
' API Gateway & Service Mesh (Gateway Routing 패턴)
|
|
package "Gateway 계층" #lightyellow {
|
|
[API Gateway\n(Spring Cloud Gateway)] as APIGateway
|
|
[Service Mesh (Istio)] as ServiceMesh
|
|
}
|
|
|
|
' Clean Architecture 기반 마이크로서비스
|
|
package "사용자 컨텍스트" #lightgreen {
|
|
[User Service\n(Clean Architecture)] as UserService
|
|
note right of UserService
|
|
**주요 기능**
|
|
• Google SSO 인증
|
|
• 사용자 프로필 관리
|
|
• 직업군별 코드 변환
|
|
• JWT 토큰 생성/검증
|
|
end note
|
|
}
|
|
|
|
package "건강 컨텍스트" #lightgreen {
|
|
[Health Service\n(Clean Architecture)] as HealthService
|
|
note right of HealthService
|
|
**주요 기능**
|
|
• 건강검진 데이터 연동
|
|
• 정상치 기준 비교 분석
|
|
• Azure Blob 파일 업로드
|
|
• 건강 위험도 계산
|
|
• 캐싱 기반 성능 최적화
|
|
end note
|
|
}
|
|
|
|
package "목표 컨텍스트" #lightgreen {
|
|
[Goal Service\n(Clean Architecture)] as GoalService
|
|
note right of GoalService
|
|
**주요 기능**
|
|
• 미션 선택/관리
|
|
• 목표 달성 추적
|
|
• 이력 분석
|
|
• 진행률 계산
|
|
end note
|
|
}
|
|
|
|
package "지능형서비스 컨텍스트" #lightgreen {
|
|
[Intelligence Service\n(Clean Architecture)] as IntelligenceService
|
|
note right of IntelligenceService
|
|
**주요 기능**
|
|
• Claude AI 기반 건강 진단
|
|
• 개인화 미션 추천
|
|
• 챗봇 상담
|
|
• 독려 메시지 생성
|
|
• 배치 알림 처리
|
|
end note
|
|
}
|
|
|
|
' 통합 데이터 저장소
|
|
package "데이터 저장소" #lightpink {
|
|
[PostgreSQL\n(통합 DB)] as PostgreSQL
|
|
[Redis Cache] as Redis
|
|
[Azure Blob Storage\n(건강검진 파일)] as BlobStorage
|
|
|
|
note right of PostgreSQL
|
|
**통합 스키마**
|
|
• User 테이블
|
|
• Health 관련 테이블
|
|
• Goal 관련 테이블
|
|
• Normal Range 테이블 (신규)
|
|
• Chat History 테이블
|
|
end note
|
|
}
|
|
|
|
' 메시징 인프라 (Event-Driven Architecture)
|
|
package "메시징 인프라" #lightsalmon {
|
|
[Azure Service Bus\n(Event Store)] as EventStore
|
|
[Command Queue] as CommandQueue
|
|
}
|
|
|
|
' 외부 시스템 연동 (Anti-Corruption Layer 패턴)
|
|
package "외부 시스템" #lightblue {
|
|
[Google SSO] as GoogleSSO
|
|
[Claude API] as ClaudeAPI
|
|
}
|
|
|
|
package "보호 계층" #orange {
|
|
[Auth ACL] as AuthACL
|
|
[AI Service ACL] as AIACL
|
|
}
|
|
|
|
' === 핵심 처리 흐름 (개발 소스 기반) ===
|
|
|
|
' 1. 클라이언트 요청
|
|
MobileApp -[#blue,thickness=3]-> APIGateway : "1. RESTful API 요청"
|
|
|
|
' 2. Gateway Routing
|
|
APIGateway -[#green,thickness=2]-> ServiceMesh : "2. 서비스 라우팅 & 로드밸런싱"
|
|
|
|
' 3. Clean Architecture 기반 서비스 호출
|
|
ServiceMesh -[#purple,thickness=2]-> UserService : "3a. /api/users/* - 인증 & 프로필"
|
|
ServiceMesh -[#purple,thickness=2]-> HealthService : "3b. /api/health/* - 건강데이터"
|
|
ServiceMesh -[#purple,thickness=2]-> GoalService : "3c. /api/goals/* - 목표관리"
|
|
ServiceMesh -[#purple,thickness=2]-> IntelligenceService : "3d. /api/intelligence/* - AI 분석"
|
|
|
|
' 4. 통합 데이터 저장 (PostgreSQL)
|
|
UserService -[#red,thickness=2]-> PostgreSQL : "4a. 사용자 & 직업코드 데이터"
|
|
HealthService -[#red,thickness=2]-> PostgreSQL : "4b. 건강검진 & 정상치 데이터"
|
|
GoalService -[#red,thickness=2]-> PostgreSQL : "4c. 목표 & 미션 데이터"
|
|
IntelligenceService -[#red,thickness=2]-> PostgreSQL : "4d. 채팅 & 분석 이력"
|
|
|
|
' 5. Azure Blob Storage 연동
|
|
HealthService -[#brown,thickness=2]-> BlobStorage : "5. 건강검진 파일 저장"
|
|
|
|
' 6. Redis 캐싱 (Cache-Aside 패턴)
|
|
HealthService -[#orange,thickness=2]-> Redis : "6a. 건강이력 캐싱 (1시간)"
|
|
IntelligenceService -[#orange,thickness=2]-> Redis : "6b. AI 분석결과 캐싱 (30분)"
|
|
GoalService -[#orange,thickness=2]-> Redis : "6c. 활성미션 캐싱 (30분)"
|
|
|
|
' 7. 외부 시스템 연동 (ACL 패턴)
|
|
UserService -[#navy,thickness=2]-> AuthACL : "7a. Google 인증 요청"
|
|
AuthACL -[#navy,thickness=2]-> GoogleSSO : "7b. OAuth 2.0 인증"
|
|
IntelligenceService -[#navy,thickness=2]-> AIACL : "7c. Claude AI 요청"
|
|
AIACL -[#navy,thickness=2]-> ClaudeAPI : "7d. AI 분석/채팅 API"
|
|
|
|
' 8. 이벤트 기반 통신
|
|
UserService -[#magenta,thickness=2,dashed]-> EventStore : "8a. 사용자 등록/수정 이벤트"
|
|
HealthService -[#magenta,thickness=2,dashed]-> EventStore : "8b. 건강데이터 동기화 이벤트"
|
|
GoalService -[#magenta,thickness=2,dashed]-> EventStore : "8c. 목표달성 이벤트"
|
|
|
|
' 9. Command/Query 분리
|
|
EventStore -[#cyan,thickness=2,dotted]-> CommandQueue : "9a. 배치 명령 큐"
|
|
CommandQueue -[#cyan,thickness=2,dotted]-> IntelligenceService : "9b. 주기적 알림 처리"
|
|
|
|
' === 패턴 적용 노트 ===
|
|
note right of APIGateway
|
|
**Gateway 패턴**
|
|
• JWT 토큰 검증
|
|
• Rate Limiting
|
|
• CORS 처리
|
|
• 로드밸런싱
|
|
end note
|
|
|
|
note right of PostgreSQL
|
|
**통합 DB 패턴**
|
|
• 마이크로서비스별 스키마 분리
|
|
• 트랜잭션 일관성
|
|
• 정상치 기준 중앙 관리
|
|
end note
|
|
|
|
note right of Redis
|
|
**캐싱 패턴**
|
|
• Cache-Aside
|
|
• TTL 기반 만료
|
|
• 성능 최적화
|
|
end note
|
|
|
|
note right of EventStore
|
|
**이벤트 패턴**
|
|
• 비동기 통신
|
|
• 서비스 간 결합도 최소화
|
|
• 확장성 확보
|
|
end note |