RelationshipsOverview

Relationships Overview

A relationship is an edge between two entity instances — who follows whom, which users marked going to a show, friend requests between users.

The engine stores edges in a dedicated relationship store. You declare them in .relationships.causet files and create or remove edges with relationship_create and relationship_remove in intent rules.


How relationships fit into the write path

Write path: Intent creates an edge → engine may emit ARTIST_FOLLOWED → projection materializes a queryable join table.

Read path: Query user_following (or similar) and join to other projection tables — the relationship store itself is not queried directly.


Declaring relationships

# app.causet
includes:
  relationships: [./relationships/**/*.relationships.causet]
relationships:
  artist_followers:
    from: user
    to:   artist
    cardinality: many_to_many
    unique: true
    emit_events:
      created: ARTIST_FOLLOWED
      removed: ARTIST_UNFOLLOWED

In this section

PageWhat it covers
ConceptEdges vs projections, when to use relationships
Defining RelationshipsFull DSL — cardinality, unique, emit_events, ops
Best PracticesIdempotency, preflight, projection patterns
ExamplesConcert-app follow and show-going edges

Next steps