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_UNFOLLOWEDIn this section
| Page | What it covers |
|---|---|
| Concept | Edges vs projections, when to use relationships |
| Defining Relationships | Full DSL — cardinality, unique, emit_events, ops |
| Best Practices | Idempotency, preflight, projection patterns |
| Examples | Concert-app follow and show-going edges |
Next steps
- Intents —
relationship_createin core rules - Projection Examples —
user_followingjoin table - Query Examples —
shows_for_followed_artistsjoin