Page Contents

LoopBack 4 provides command-line tools to help you get started quickly. The command line tools generate application and extension projects and install their dependencies for you. The CLI can also help you generate artifacts, such as controllers, for your projects. Once generated, the scaffold can be expanded with users’ own code as needed.

To use LoopBack 4’s CLI, run this command:

npm install -g @loopback/cli

Generating LoopBack projects

Commands Description See
lb4 Create a new LoopBack4 application Application generator
lb4 extension Create a new LoopBack4 extension Extension generator
lb4 example Download one of LoopBack example projects Download examples

Generating LoopBack artifacts

Commands Description See
lb4 controller Add a new controller to a LoopBack 4 application Controller generator
lb4 datasource Add a new datasource to a LoopBack 4 application DataSource generator
lb4 model Add a new model to a LoopBack 4 application Model generator
lb4 repository Add new repositories for selected model(s) to a LoopBack 4 application Repository generator
lb4 service Add new service for a selected datasource to a LoopBack 4 application Service generator
lb4 openapi Generate controllers and models from OpenAPI specs OpenAPI generator