전체 글
-
이코에코(Eco²) Clean Architecture #5: Message Consumer이코에코(Eco²)/Clean Architecture Migration 2025. 12. 31. 19:53
개요웹 서버가 아닌 메시지 컨슈머(Worker)에서 Clean Architecture를 적용한 과정을 기록합니다.HTTP API 서버에서는 Controller → Use Case → Repository 패턴이 익숙하지만, MQ 기반 워커에서는 "어디까지가 Presentation이고, 어디서부터 Application인가?"가 모호합니다. 이 글에서는 auth-worker 구현을 통해 메시지 컨슈머에 Clean Architecture를 적용한 방법을 서술합니다.핵심 질문Presentation Layer가 필요한지, 웹 서버와는 어떻게 다른지ack/nack은 누가 결정하는지Infrastructure와 Application 경계는? etc. RabbitMQ 연결은 어디에 두나?설계 원칙1. Composition..
-
이코에코(Eco²) Clean Architecture #4 Auth Persistence Offloading이코에코(Eco²)/Clean Architecture Migration 2025. 12. 31. 17:54
개요인증 서비스(auth-api)에서 직접 수행하던 영속성 작업을 별도의 워커(auth-worker, auth-relay)로 분리한 과정을 기록합니다. 느슨한 결합(Loose Coupling), 확장성(Scalability), 유지보수성(Maintainability)을 우선 가치로 삼았습니다.배경기존 아키텍처의 문제점기존 auth-api는 다음과 같은 영속성 작업을 동기적으로 수행했습니다:┌─────────────────────────────────────────────────────────────┐│ auth-api ││ ..
-
이코에코(Eco²) Clean Architecture #3: Auth 버전 분리, 점진적 배포이코에코(Eco²)/Clean Architecture Migration 2025. 12. 31. 03:27
배포 전략: Canary리팩토링된 코드를 바로 배포해 클라이언트로 노출하는 것은 위험. Canary 배포로 일부 트래픽만 새 버전으로 라우팅하여 검증, PR에 부착된 Canary 라벨을 감지해 Canary 태그를 부착한 채로 패키징.┌─────────────────────────────────────────────────────────┐│ Istio VirtualService │├─────────────────────────────────────────────────────────┤│ X-Canary: true → auth-api-canary (version: v2) ││ (default) → auth-api (v..
-
이코에코(Eco²) Clean Architecture #2: Auth Clean Architecture 구현 초안이코에코(Eco²)/Clean Architecture Migration 2025. 12. 31. 03:26
아키텍처 개요계층 구조와 의존성 방향의존성 규칙(Dependency Rule): 모든 의존성은 바깥에서 안쪽으로만 향한다.핵심 원칙 설명:Domain 독립성: 비즈니스 로직이 프레임워크나 DB에 종속되지 않음의존성 역전(DIP): Application이 Port(Interface)를 정의하고, Infrastructure가 구현테스트 용이성: 각 레이어를 Mock으로 대체하여 격리 테스트 가능유연한 교체: Redis → Memcached, PostgreSQL → MongoDB 전환 시 Infrastructure만 변경현재 디렉토리 구조apps/auth/├── main.py # FastAPI 앱 진입점├── setup/│ ├── config/settings...
-
이코에코(Eco²) Clean Architecture #1: Auth 문제사안 도출, 리팩토링 전략이코에코(Eco²)/Clean Architecture Migration 2025. 12. 31. 03:24
기존 구조의 문제점폴더 구조domains/auth/├── tasks/ # 워커│ └── blacklist_relay.py├── database/ # DB 연결/세션├── interfaces/ # 추상화 인터페이스└── services/ # 비즈니스 로직문제 1: God Objectclass AuthService: def __init__( self, session: AsyncSession = Depends(get_db_session), token_service: TokenService = Depends(TokenService), state_store: OAuthStateStore = Depends(OAu..
-
이코에코(Eco²) Clean Architecture #0: Auth 리팩토링.MD이코에코(Eco²)/Clean Architecture Migration 2025. 12. 31. 01:10
작성일: 2025-12-31Opus 4.5와의 문답, 자료조사를 거치며 디벨롭한 문서이며 리팩토링 전 과정의 초안이 됩니다.1. 개요1.1 목표현재 domains/auth/ 구조를 Clean Architecture 원칙에 따라 apps/auth/로 리팩토링합니다.1.2 주요 변경사항항목현재목표루트 경로domains/auth/apps/auth/아키텍처혼합된 레이어드Clean Architecture의존성 방향양방향단방향 (안쪽으로만)ORM 결합Entity = ORM 모델Entity/ORM 분리2. 현재 기능 분석2.1 AuthService 메서드 → Use Case 매핑현재 메서드목표 Use Case타입파일authorize()OAuthAuthorizeInteractorCommandcommands/oauth_..
-
FastAPI Clean ExampleKnowledge Base/Python 2025. 12. 31. 00:29
참조: ivan-borovets/fastapi-clean-example작성일: 2025-12-30이 프로젝트에서 사용하는 아키텍처 패턴들의 원본 출처와 핵심 개념입니다.Clean Architecture항목내용창시자Robert C. Martin ("Uncle Bob")발표2012년 8월 블로그 → 2017년 책 출간원본The Clean Architecture책Clean Architecture: A Craftsman's Guide to Software Structure and Design (2017)핵심 원칙:의존성 규칙 (Dependency Rule): 의존성은 항상 안쪽(고수준)으로만 향한다독립성: Framework, UI, Database, 외부 에이전시로부터 독립적동심원 구조: Entities → U..
-
이코에코(Eco²) Deployment Strategy: Canary Deployments이코에코(Eco²) 2025. 12. 30. 22:10
2024-12-30 | 리팩토링을 앞두고 안전한 배포 전략 수립 TL;DR문제: 대규모 Clean Architecture 리팩토링을 안전하게 배포해야 함선택지: Rolling Update, Blue-Green, Canary결정: Canary 배포 (헤더 기반)이유: 기존 Istio 인프라 활용, 비용 효율성, 점진적 검증 가능1. 배경1.1 현재 상황도메인 서비스들의 Clean Architecture 리팩토링을 앞두고 있다. Auth 서비스를 시작으로 모든 도메인 서비스에 다음 변경이 예정되어 있다: 디렉토리 구조 전면 개편 (models/ → domain/entities/, services/ → application/commands/ 등) CQRS 패턴 도입 (Command/Query 분리) Re..