Skip to content

Architecture Overview

The CO2 Asset Management platform is built using Domain-Driven Design (DDD) principles combined with Clean Architecture and CQRS patterns.

┌─────────────────────────────────────────────────────────────┐
│ Presentation Layer │
│ (Flutter UI, Riverpod, GoRouter) │
├─────────────────────────────────────────────────────────────┤
│ Application Orchestration │
│ (Commands, Queries, Event Handlers, Workflows) │
├─────────────────────────────────────────────────────────────┤
│ Domain Layer │
│ (Aggregates, Events, Value Objects per Bounded Context) │
├─────────────────────────────────────────────────────────────┤
│ Infrastructure Layer │
│ (Firebase, Local Storage, Sync Engine) │
└─────────────────────────────────────────────────────────────┘

The Core Layer defines semantically stable, cross-cutting value objects and contracts shared between bounded contexts:

  • Identifiers: AssetId, EstateId, UserId with strong typing
  • Roles & Scopes: Centralized permission types
  • Value Objects: Timestamp, EmailAddress, GeoCoordinate
  • Interfaces: Identifiable<T>, common error types

Each bounded context contains:

  • Event-Sourced Aggregates: Emit domain events for all state changes
  • No Cross-Context Ownership: Each context owns its data
  • Typed Composition: Capabilities via separate bounded contexts

Coordinates business operations:

  • Command Handlers: Execute write operations
  • Query Handlers: Read-only data access
  • Event Handlers: React to domain events
  • Workflows: Multi-step business processes

Flutter UI using:

  • Riverpod: State management (migrating from GetX)
  • GoRouter: Navigation
  • Notifiers: Per-screen state management

See Nomos Framework for details on:

  • Intents (user commands)
  • Directives (atomic mutations)
  • Events (audit trail)
  • Workspaces and Timelines

The admin app is split into three packages:

PackagePurpose
apps/adminEntry point, tests, assets
apps/admin_frontendViews, components, state management
apps/admin_compositionDomain registration and wiring