Layered Architecture
The application is organized into the following layers:Domain Layer
Core business logic and rules
Application Layer
Application services and interfaces
Infrastructure Layer
External integrations (HTTP, WebSocket)
Presentation Layer
UI components and contexts
Directory Structure
Layer Details
- Domain Layer
- Application Layer
- Infrastructure Layer
- Orchestration Layer
- Presentation Layer
Domain Layer
The domain layer contains pure business logic with no external dependencies. It defines the core rules and types of the application.Location:domain/Key Responsibilities:- Define domain types (e.g.,
OrderStatus) - Implement business rules (e.g.,
canTransition) - No dependencies on other layers
domain/order/order-transitions.ts
Data Flow
Benefits of This Architecture
Testability
Each layer can be tested in isolation with mocked dependencies
Maintainability
Clear separation makes it easy to locate and modify code
Flexibility
Swap implementations (e.g., replace HTTP with GraphQL) without changing business logic
Scalability
Add new features by following established patterns
Next Steps
Order Status
Learn about order status types and transition rules
Real-time Sync
Understand how WebSocket synchronization works