클린 아키텍처
핵심 애플리케이션 로직이 DB·UI·웹 프레임워크·외부 제공자에 의존하지 않도록 분리하는 설계 철학
구조와 동작 원리
화살표를 단계별로 확인하세요.
소스 코드 의존성은 바깥에서 안으로 향한다. 런타임 호출 방향과 반드시 같지는 않다.
기대 효과
모듈성·테스트 용이성·유지보수성 향상
트레이드오프
제품 기능 선택 문제를 직접 해결하지 못하는 한계
제품 기능 선정 방법이 아니므로 기능 로드맵·제품 결정 도구로 오용하지 않도록 주의
운영 및 적용 가이드
종합 설명 · 원문 인용으로 검증된 항목과 구분됩니다. 실제 적용 전 확인이 필요합니다.
언제 사용하는가
변경이 잦은 엔터프라이즈/SaaS에서 핵심 업무 규칙을 프레임워크·DB·UI와 분리해 테스트와 기술 교체를 용이하게 하는 설계에 사용한다.
시나리오
직원 2,000명 규모 제조사의 주문·재고 SaaS를 월 500만 건 트랜잭션으로 운영하며, 3년 내 DB·UI 교체 가능성과 감사 로그 요구가 있다. 핵심 주문 규칙은 도메인·유스케이스에 두고 웹·DB·메시징은 어댑터로 분리한다. 계층별 테스트와 교체 가능성을 확보하고 Kubernetes/GitOps로 배포·운영한다.
배치 원칙
- 도메인 엔티티·유스케이스는 코어에 두고 외부 의존 금지
- 컨트롤러·프레젠터·게이트웨이는 인터페이스 어댑터 계층에 배치
- DB·웹·메시징·외부 API는 프레임워크/드라이버 계층에 플러그인으로 배치
- 의존성은 항상 안쪽으로 향하도록 DI 구성
- 배포·설정·시크릿은 GitOps와 시크릿 관리 도구로 코드와 분리
온프레미스
코어가 온프레미스 DB·미들웨어에 직접 의존하지 않게 하고 어댑터 교체로 인프라 전환에 대비한다. 배포는 재현 가능한 패키지·컨테이너와 구성 분리로 관리하고, 운영은 중앙 로그·메트릭·트레이싱, 백업/DR, 의존성 장애 격리를 적용한다.
클라우드
관리형 DB·큐·스토리지는 어댑터 뒤로 숨겨 제공자 교체와 멀티클라우드 대비를 쉽게 한다. CI/CD·IaC·GitOps로 반복 배포하고, 시크릿·권한은 클라우드 IAM과 연동하며 관측성·오토스케일·AZ 장애 대비를 구성한다.
Kubernetes
워크로드는 Deployment/Service/Ingress 등 선언적 매니페스트로 관리하고 GitOps 소스 오브 트루스와 환경별 오버레이를 둔다. 시크릿은 Sealed Secrets/External Secrets 등으로 관리하고 readiness/liveness, HPA/PDB, 롤링·카나리 배포, 중앙 로그·메트릭을 적용한다.
장애 대응
대표 장애는 의존성 장애로 인한 연쇄 과부하, 설정·배포 오류, DB 연결 고갈이다. 알림과 영향 범위 확인 후 최근 배포·설정 롤백 또는 트래픽 차단을 하고, 서킷브레이커·재시도 백오프·부하 차단으로 전파를 막은 뒤 로그·메트릭·트레이스로 원인을 분석하고 포스트모템으로 재발을 방지한다.
14개 관점별 근거
조사 당시 근거 보유 여부입니다. 출처의 정확성과 최신성을 별도로 판단하세요.
정의·개요근거 있음
핵심 애플리케이션 로직이 DB·UI·웹 프레임워크·외부 제공자에 의존하지 않도록 분리하는 설계 철학
core application logic should not depend on databases, user interfaces, web frameworks, or external providers.해결하는 문제근거 있음
업무 규칙과 전달 기술을 분리해 기술 변경·교체가 핵심 로직에 미치는 영향을 줄이는 문제를 해결
separates business rules from the technologies used to deliver them주요 구성 컴포넌트·리소스근거 있음
엔티티, 유스케이스, 인터페이스 어댑터(컨트롤러·프레젠터·게이트웨이), 프레임워크/드라이버 계층으로 구성
Entities (enterprise business rules) → Use Cases (application business rules) → Interface Adapters (controllers, presenters, gateways)데이터·에셋 배치 원칙근거 있음
DB·UI·외부 제공자 등 세부 구현은 코어에 의존하도록 배치하고, 코어는 이들에 의존하지 않게 함
Those implementation details should depend on the core instead.대표 유스케이스근거 있음
특정 라이브러리·인프라에 초기 종속되지 않게 설계하고 기술 선택을 지연·교체 가능하게 하는 개발
design software without getting tied down to specific libraries, infrastructure, or other choices right from the start시나리오 예시근거 있음
엔터프라이즈/SaaS에서 제품 동작 변경 시 핵심 로직 재작성 없이 기술·전달 방식을 바꿀 수 있는지 검토하는 상황
For enterprise software and SaaS, meaning software as a service, the practical question is: can the company change how its product operates부적합 상황·주의근거 있음
제품 기능 선정 방법이 아니므로 기능 로드맵·제품 결정 도구로 오용하지 않도록 주의
not a method for selecting product features.온프레미스 관점(개발·배포·운영)근거 있음
라이브러리·인프라 교체가 쉬워 온프레미스에서 특정 미들웨어·DB 종속을 줄이는 관점
makes it easier to switch libraries or infrastructure if needed클라우드 관점(개발·배포·운영)근거 있음
코어가 외부 제공자에 비의존하므로 클라우드 관리형 서비스 교체·이전이 용이
core application logic should not depend on databases, user interfaces, web frameworks, or external providers.Kubernetes 관점(개발·배포·운영)근거 있음
Kubernetes 운영은 GitOps와 Git/OCI 레지스트리를 소스 오브 트루스로 두는 선언적 구성이 필요
All configuration affecting production clusters must originate from a GitOps engine using Git or OCI registries as sources of truth.장애 대응 관점근거 있음
중앙 로그 인터페이스로 로그를 모아 장애 탐색과 MTTR 개선
Centralize your logs to be viewable through a single interface장점근거 있음
모듈성·테스트 용이성·유지보수성 향상
modular, testable, and maintainable code단점·트레이드오프근거 있음
제품 기능 선택 문제를 직접 해결하지 못하는 한계
not a method for selecting product features.대표 기술·도구근거 있음
.NET 구현에서 Domain/Application 계층에 MediatR 핸들러·DTO·검증기 사용
MediatR handlers, DTOs, validators추가 참고 문헌 (24)
- What is Clean Architecture? - by Dr Milan Milanović ↗
- Clean Architecture Framework Guide ↗
- 27. The Clean Architecture - Clean Code: A Handbook of Agile Software Craftsmanship, 2nd Edition [Book] ↗
- Chapter 2: Introduction to Clean Architecture - Clean Architecture with .NET [Book] ↗
- Implementing clean architecture solutions: A practical example | Red Hat Developer ↗
- Part 6: Software Architecture & Design Patterns - Wasil Zafar ↗
- architecture/clean-architecture.md ↗
- Clean Architecture – DevIQ ↗
- How to Run Kubernetes Across On-Premises and Public Cloud: Four Hybrid Architecture Models and the Seven Layers to Standardize ↗
- KubeAid CLI - Architecture | KubeAid ↗
- Architecture Best Practices for Azure Kubernetes Service (AKS) - Microsoft Azure Well-Architected Framework | Microsoft Learn ↗
- Multi-Cloud Kubernetes Without Three Toolchains | Ops-Box ↗
- Reference Architecture: GKE Enterprise hybrid environment - part 2 - Dec '24 - Google Docs ↗
- Deploy Containerized Apps with AKS Hybrid and Edge by Using GitOps - Azure Architecture Center | Microsoft Learn ↗
- Kubernetes Management Platform ↗
- Platform9 Architecture and Technical Overview | Managed Kubernetes | Platform9 Private Cloud Director Documentation ↗
- Bottleneck #05: Resilience and Observability ↗
- 2.20 Error handling and resilience patterns — Software Engineering Guide ↗
- Resilience Patterns · Principles | gsantana.dev ↗
- Chapter 33 — Reliability Engineering: Resilience Patterns, SLOs, and DR | Backend Engineering From First Principles ↗
- Common mitigation strategies ↗
- Design for Self-Healing - Azure Architecture Center | Microsoft Learn ↗
- AWS Prescriptive Guidance - Resilience analysis framework ↗
- Google SRE - Cascading Failures: Reducing System Outage ↗