customer_relation 0.1.0 copy "customer_relation: ^0.1.0" to clipboard
customer_relation: ^0.1.0 copied to clipboard

A deterministic, domain-driven customer relationship and trust model with strict invariants.

customer_relation #

A deterministic, domain-driven customer relationship and trust model for Dart.

This package helps you model customers, profiles, trust levels, and brand relationships with strict invariants, immutable identities, and fully controlled time.

If a rule can be violated, the API is considered broken.


Why this package exists #

Most customer/loyalty systems fail because:

  • Identity can be mutated accidentally
  • Trust levels can be skipped or forged
  • Business rules live in services instead of the domain
  • Time (DateTime.now()) makes logic untestable and non-replayable

customer_relation fixes this by enforcing rules inside the domain, not in documentation or developer discipline.


Core principles #

  • Identity is sacred
    Customer identity fields are immutable and validated.

  • Trust is monotonic
    Relationship levels can only move forward in a defined order.

  • No hidden mutations
    All state changes go through explicit intent-revealing methods.

  • Time is injected, not magical
    No DateTime.now() leaks into the domain.

  • Deterministic by design
    Same input + same time = same output.


Features #

  • Immutable CustomerId
  • Safe CustomerProfile mutation
  • Brand relationship lifecycle
  • Trust level progression
    Identity → Habit → Legend
  • Relationship status management
  • Clock / TimeProvider abstraction
  • Fully testable & replayable domain logic

Installation #

dart pub add customer_relation
0
likes
115
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

A deterministic, domain-driven customer relationship and trust model with strict invariants.

Documentation

API reference

License

unknown (license)

Dependencies

meta, test

More

Packages that depend on customer_relation