Page Contents

The models involved in the relation must also exist before running this generator.


Creates a new model relation in a LoopBack application.

lb relation [options]

With IBM API Connect v5 developer toolkit:

apic loopback:relation [options]

With legacy StrongLoop tools:

$ slc relation [options]


-h, --help
Print the generator’s options and usage.
Do not remember prompt answers. Default is false.
Do not automatically install dependencies. Default is false.

Interactive Prompts

The tool will prompt you for:

  • Custom foreign key (optional)
  • Whether a “through” model is required.  Repy “Y” to create a HasManyThrough relations
  • Name of the “through” model, if appropriate.


Updates the Model definition JSON files for the models involved in the relation.