FitFoYo 아키텍처

FitFoYo 아키텍처 A architecture diagram generated by Archify. Vercel · apps/web Railway · apps/api 브라우저 · 사용자 · Architecture component 브라우저 사용자 Client Components · apps/web · Zustand · Optimistic UI · Vercel · apps/web Client Components apps/web · Zustand · Optimistic UI BFF Layer · Route Handlers · proxy.ts · Vercel · apps/web BFF Layer Route Handlers · proxy.ts NestJS API · apps/api · Railway · apps/api · helmet · CORS · Throttler · ValidationPipe NestJS API apps/api helmet · CORS · Throttler · ValidationPipe Auth Module · JWT 회전 · Google OAuth · Railway · apps/api · 게스트 정리 Cron 03:00 Auth Module JWT 회전 · Google OAuth 게스트 정리 Cron 03:00 Domain Services · Records · HealthProfile · Nutrition · Railway · apps/api · 추천 생성 Cron Domain Services Records · HealthProfile · Nutrition 추천 생성 Cron AI Engine · Function Calling · 2-pass · Railway · apps/api · 도메인 이탈 필터 AI Engine Function Calling · 2-pass 도메인 이탈 필터 Google OAuth · OAuth 2.0 · Architecture component Google OAuth OAuth 2.0 PostgreSQL · Neon · Prisma · Architecture component PostgreSQL Neon · Prisma OpenAI API · gpt-4.1-mini · Architecture component OpenAI API gpt-4.1-mini HTTPS 요청 fetch (데이터 요청) HttpOnly · Secure 쿠키 발급 Bearer 토큰 · REST 인증 라우팅 도메인 라우팅 AI 라우팅 OAuth 2.0 로그인 Prisma · Refresh 해시 대조 Prisma · CRUD Function Calling (2-pass) Tool Call 실행 (기록 CRUD) 일일 추천 생성 (Cron) Legend Frontend Backend Database Security External

BFF 인증

  • • HttpOnly · Secure 쿠키는 web 도메인(Vercel)에서 발급
  • • Access/Refresh 토큰 회전, bcrypt 해시 대조
  • • Google OAuth 연동

AI 파이프라인 · 칼로리 신뢰성

  • • Function Calling 2-pass (CRUD 결정 → 자연어 응답)
  • • 병렬 tool 호출로 혼합 입력을 식단·운동으로 분리
  • • 등록 음식은 FoodNutrition 시드로 서버 재계산, 미등록은 '추정' 배지

비용 · 보안 방어

  • • 게스트 AI 사용 횟수 상한 + 24시간 경과 데이터 하드 삭제 Cron
  • • Throttler · helmet · CORS 화이트리스트 · ValidationPipe
  • • 헬스케어 도메인 이탈 시 INVALID_DOMAIN 예외