Skip to main content

CLI commands

Below you can find the available commands in @grafana/create-plugin.

create-plugin​

Use the create-plugin command to scaffold your plugin.

npx @grafana/create-plugin@latest

When running the create-plugin command, the following prompts appear:

Select a plugin type​

? Select a plugin type …
❯ App (add custom pages, UI extensions and bundle other plugins)
Data source (query data from a custom source)
Panel (add a visualization for data or a widget)
App with Scenes (create dynamic dashboards in app pages)

To learn more about the various types of plugins, refer to Grafana plugin types and usage.

For more information on how Scenes allows you to create dashboard-like experiences in app plugins, see the Scenes documentation.

Add a backend to support server-side functionality? (y/N)​

If you are creating an app or a data source plugin, you will be asked whether to additionally add a backend component.

Backend plugins offer powerful features such as:

  • Enable Grafana Alerting for data sources.
  • Connect to non-HTTP services to which a browser normally can’t connect. For example, SQL database servers.
  • Keep state between users. For example, query caching for data sources.
  • Use custom authentication methods and/or authorization checks that aren’t supported in Grafana.
  • Use a custom data source request proxy.

To learn more, refer to Backend plugins.

Enter a name for your plugin​

Give your plugin a name which helps identify its purpose.

Enter your organization name (usually your Grafana Cloud org)​

Enter the name of your organization. This must be your Grafana Cloud organization. With the organization name you can sign and optionally publish the plugin to the Grafana plugin catalog.

Bypass prompts​

You can bypass all the preceding prompts by using create-plugin CLI arguments. To scaffold a plugin with the CLI arguments, pass them to the create-plugin command like so:

npx @grafana/create-plugin \
--plugin-type="app" \
--plugin-name="myPlugin" \
--org-name="myorg" \
--backend

You can scaffold plugins using CLI arguments to get started faster. Using arguments also allows you to run the tool in a non-interactive environment such as CI or to scaffold plugins with other tooling.

Refer to the following table for the full list of prompt bypass options:

PromptEquivalent Argument NameValues
Plugin type--plugin-typeone of app, datasource, panel or scenesapp
Backend--backend / --no-backendboolean
Name--plugin-namestring
Organization--org-namestring

update​

To update an existing plugin to use the latest version of the create-plugin tool, run the following command from your plugin's root directory:

npx @grafana/create-plugin@latest update

This command updates the following:

  • /.config - configuration files for building a plugin
  • NPM dependencies - dependencies (mostly used for supporting latest Grafana versions and build updates)
  • NPM scripts - any updates in build-related scripts

update --force​

By default, the update command will stop if there are any uncommitted changes in the repository. If you want to force the update, you can use the --force flag:

npx @grafana/create-plugin@latest update --force