AppDefinition is the entity that represents an app in Contentful.
It contains general app information, like where it is visible, who can install the app, and provides settings for enabling it to run independently, or enable particular settings for any current and future installations.
All this metadata helps to inform Contentful about how to handle your app when installing, serving, and running the app.
App definitions are owned by an organization and can be managed in the organization settings, but this does not mean they are running inside an organization.
App definitions do not do anything by themselves, instead, they have to be installed into a space environment.
Doing this creates an
AppInstallation, which is linked to an
AppDefinition and denotes that the specific app is running inside the chosen space.
This means you only need to register an app once (i.e: create an app definition) and can then install the apps in any number of space environments. Any updates to an app definition will be immediately reflected in all existing and future app installations.
You can create an
AppDefinition through the API, or by visiting the web app's app management view and then clicking on the "Create app" button on the top right.
You can also create one using the create-contentful-app CLI tool by running the
npx create-contentful-app create-definition command.