!theme mono skinparam sequenceArrowThickness 2 skinparam sequenceParticipantBorderThickness 2 skinparam sequenceActorBorderThickness 2 skinparam sequenceGroupBorderThickness 2 title HealthSync 역설계 - 외부 시퀀스 다이어그램 (개발 소스 기반) participant "React 모바일 앱" as MobileApp participant "API Gateway" as Gateway participant "User Service" as UserSvc participant "Health Service" as HealthSvc participant "Goal Service" as GoalSvc participant "Intelligence Service" as IntelSvc participant "Google SSO" as GoogleSSO participant "Claude API" as ClaudeAPI participant "Azure Blob Storage" as BlobStorage participant "Redis Cache" as Redis participant "PostgreSQL" as DB == 1. 사용자 인증 및 등록 == MobileApp -> Gateway: POST /api/users/auth/google-login (구글 로그인) Gateway -> UserSvc: POST /auth/google-login UserSvc -> GoogleSSO: OAuth 2.0 인증 요청 UserSvc -> DB: 사용자 조회/생성 UserSvc -> UserSvc: JWT 토큰 생성 MobileApp -> Gateway: POST /api/users/profile/complete (프로필 완료) Gateway -> UserSvc: POST /profile/complete UserSvc -> DB: 사용자 프로필 업데이트 MobileApp -> Gateway: GET /api/users/profile (프로필 조회) Gateway -> UserSvc: GET /profile UserSvc -> DB: 사용자 정보 조회 == 2. 건강검진 데이터 관리 == MobileApp -> Gateway: POST /api/health/checkup/sync (건강검진 연동) Gateway -> HealthSvc: POST /checkup/sync HealthSvc -> DB: 건강보험공단 원본 데이터 조회 HealthSvc -> DB: 성별별 정상치 기준 조회 HealthSvc -> DB: 정상치 비교 분석 후 저장 HealthSvc -> Redis: 분석 결과 캐싱 MobileApp -> Gateway: GET /api/health/checkup/history (건강검진 이력) Gateway -> HealthSvc: GET /checkup/history HealthSvc -> Redis: 캐시 조회 alt 캐시 미스 HealthSvc -> DB: 건강검진 이력 조회 HealthSvc -> Redis: 결과 캐싱 end MobileApp -> Gateway: POST /api/health/checkup/upload (파일 업로드) Gateway -> HealthSvc: POST /checkup/upload HealthSvc -> BlobStorage: Azure Blob 파일 저장 HealthSvc -> DB: 파일 메타데이터 저장 == 3. AI 기반 건강 분석 == MobileApp -> Gateway: GET /api/intelligence/health/diagnosis (AI 3줄 요약) Gateway -> IntelSvc: GET /health/diagnosis IntelSvc -> HealthSvc: 건강검진 데이터 조회 (서비스 간 통신) IntelSvc -> ClaudeAPI: AI 분석 요청 IntelSvc -> Redis: 분석 결과 캐싱 MobileApp -> Gateway: POST /api/intelligence/missions/recommend (미션 추천) Gateway -> IntelSvc: POST /missions/recommend IntelSvc -> HealthSvc: 건강상태 조회 IntelSvc -> UserSvc: 사용자 직업정보 조회 IntelSvc -> ClaudeAPI: 개인화 미션 추천 요청 == 4. 목표 설정 및 관리 == MobileApp -> Gateway: POST /api/goals/missions/select (미션 선택) Gateway -> GoalSvc: POST /missions/select GoalSvc -> DB: 목표 설정 저장 MobileApp -> Gateway: GET /api/goals/missions/active (활성 미션 조회) Gateway -> GoalSvc: GET /missions/active GoalSvc -> Redis: 활성 미션 캐시 조회 alt 캐시 미스 GoalSvc -> DB: 활성 미션 조회 GoalSvc -> Redis: 결과 캐싱 end MobileApp -> Gateway: PUT /api/goals/missions/{missionId}/complete (미션 완료) Gateway -> GoalSvc: PUT /missions/{missionId}/complete GoalSvc -> DB: 미션 완료 처리 GoalSvc -> Redis: 관련 캐시 무효화 MobileApp -> Gateway: GET /api/goals/missions/history (미션 이력) Gateway -> GoalSvc: GET /missions/history GoalSvc -> DB: 미션 달성 이력 조회 == 5. AI 챗봇 상담 == MobileApp -> Gateway: POST /api/intelligence/chat/consultation (AI 채팅) Gateway -> IntelSvc: POST /chat/consultation IntelSvc -> DB: 채팅 히스토리 조회 IntelSvc -> ClaudeAPI: AI 챗봇 응답 요청 IntelSvc -> DB: 채팅 메시지 저장 IntelSvc -> Redis: 채팅 히스토리 캐싱 MobileApp -> Gateway: GET /api/intelligence/chat/history (채팅 이력) Gateway -> IntelSvc: GET /chat/history IntelSvc -> Redis: 캐시된 채팅 이력 조회 == 6. 알림 및 독려 시스템 == MobileApp -> Gateway: POST /api/intelligence/notifications/celebration (축하 메시지) Gateway -> IntelSvc: POST /notifications/celebration IntelSvc -> GoalSvc: 미션 달성 정보 조회 IntelSvc -> ClaudeAPI: 축하 메시지 생성 요청 Gateway -> IntelSvc: POST /batch/notifications (배치 알림 처리) IntelSvc -> GoalSvc: 모든 사용자 진행상황 조회 IntelSvc -> ClaudeAPI: 개인화 독려 메시지 생성 IntelSvc -> Redis: 알림 결과 캐싱 == 7. 목표 재설정 == MobileApp -> Gateway: POST /api/goals/missions/reset (목표 재설정) Gateway -> GoalSvc: POST /missions/reset GoalSvc -> IntelSvc: 새로운 미션 추천 요청 GoalSvc -> DB: 기존 목표 비활성화 및 새 목표 설정 == 주요 특징 == note over MobileApp, DB **개발 소스 기반 주요 특징** • JWT 기반 인증 (모든 API) • Redis 캐싱으로 성능 최적화 • Claude AI 연동 강화 • 정상치 기준 비교 분석 • Azure Blob 파일 저장 • 서비스 간 HTTP 통신 • 이벤트 기반 비동기 처리 • 예외 처리 및 회복 전략 end note