Architecture Layers
Simple Manager follows Clean Architecture principles with four distinct layers. Dependencies flow inward: outer layers depend on inner layers, but inner layers never depend on outer layers.Layer Hierarchy
1. Domain Layer
Location
src/domain/Responsibilities
- Define core entities and types
- Establish business rules
- Define interfaces (contracts)
Structure
Example: Record Entity
Domain entities are plain TypeScript interfaces with no dependencies on frameworks or libraries.
2. Application Layer
Location
src/application/Responsibilities
- Implement business use cases
- Coordinate between domain and infrastructure
- Handle validation
- Manage error handling
Structure
Example: RecordService
Services contain business logic and use repositories to access data. They don’t know about UI or database implementation details.
3. Infrastructure Layer
Location
src/infraestructure/Responsibilities
- Implement data persistence
- Database access and queries
- External API integration (future)
- File storage
Structure
Example: Database Setup
Example: Repository Implementation
4. Presentation Layer
Location
src/presentation/Responsibilities
- Render UI components
- Handle user input
- Manage local component state
- Connect to application services via hooks
Structure
Example: Custom Hook
Benefits of This Architecture
Testability
Each layer can be tested independently with mocked dependencies
Maintainability
Clear separation of concerns makes code easier to understand and modify
Scalability
Easy to add new features without affecting existing code
Flexibility
Swap implementations (e.g., SQLite → API) without changing business logic
Dependency Rule
Related Pages
Data Flow
See how data moves through layers
Folder Structure
Explore the complete project structure