How fabio-beutler/clean-react works
High-Level Architecture Layers
a) Domain Layer (Core)
• Domain entities (Account, Survey)
• Use cases (Authentication, AddAccount, LoadSurveyList)
b) Data Layer
• RemoteAuthentication, RemoteAddAccount, RemoteLoadSurveyList
• HTTP and Cache protocols
c) Presentation Layer
• React components hierarchy
• Pages (Login, Signup, SurveyList)
• Contexts and hooks
d) Main Layer (Composition Root)
• Factories and composition
• Adapters and decorators
Infrastructure Components
• AxiosHttpClient
• LocalStorageAdapter
• CookiesAdapter
External Dependencies
External services and libraries:
• React
• Axios
• Testing tools (Jest, Cypress, RTL)
Data Flow
• User interactions flow
• API calls flow
• Data persistence flow
• Authentication flow
Cross-Cutting Concerns
• Validation system
• Error handling
• Authentication/Authorization
Key Elements to Include:
Component Relationships
Frontend (Presentation) → Data Layer → Domain Layer
↑
Infrastructure Layer (Axios, Storage) → External APIs
Authentication Flow
Login/Signup Components → RemoteAuthentication → Domain Authentication → External API
Survey Flow
SurveyList Component → RemoteLoadSurveyList → Domain SurveyList → External API
Important Considerations:
Use standardized symbols
• Rectangles: Components and modules
• Circles: Clean Architecture layers
• Clouds: External services
Notes for
• Design patterns used (Factory, Adapter, Decorator)
• SOLID principles implementation points
• Testing boundaries
Cross-Cutting Concerns
• Error handling
• Validation
• Authentication
• Caching
• Clean Architecture separation
• Dependency flow (always pointing inward)
• Clear boundaries between layers
• Testing possibilities at each layer
• Factory pattern usage for dependency injection
• Decorator pattern for cross-cutting concerns
Remember to maintain a balance between detail and clarity, focusing on the architectural decisions while avoiding implementation details that don't contribute to understanding the system's structure.