Model the Data

Relationships — Backend Fundamentals

Relationships explain how records connect. In Avora, relation type, multiplicity, direction, and foreign-key owner can change the generated database and request shape.

Task

Choose the relationship that matches how records are created, reused, and deleted.

RelationUse it whenTypical request shape
AssociationRecords exist independently but reference each otherExisting ID or ID list
AggregationA parent groups reusable children without owning their lifecycleExisting ID or ID list
CompositionThe child is part of the parent and is usually created with itNested object or nested list
InheritanceOne entity shares or extends another entity's model behaviorNot a normal CRUD link

Multiplicity

MultiplicityRead it asCommon backend shape
1:1One record connects to one recordOne foreign key, often unique
0:1One optional recordNullable foreign key
1:*One parent has many childrenForeign key on the child side
*:1Many records share one parentForeign key on the source side
*:*Many records connect to many recordsHidden join table, usually exposed as ID lists

Foreign Key Owner

Avora does not show generated foreign-key columns as normal entity attributes. The diagram stays focused on the domain model, while the generator creates the required database key from the relationship edge.

The highlighted multiplicity side in the Diagram Builder shows which entity owns the foreign key. Use Auto unless the backend flow requires a specific owner.

Relationship shapeDefault foreign-key owner
1:* or 0:*Target side, usually the child or many-side record
*:1Source side, usually the many-side record
1:1 or 0:1 associationAuto-selected side, with Src or Tgt override available
*:*Hidden join table

For auth profiles, prefer the profile owning the user reference:

User 1 -------- 1 TeacherProfile
TeacherProfile owns user_id

This lets a user sign up first, then create or attach the role-specific profile without requiring a profile ID during signup.

Next

Use Diagram Builder for creating edges and Diagram Builder for relationship controls.