Skip to content

Netlify SDK command reference

The Netlify SDK includes commands that you can use to create and build your extension, as well as preview the GraphQL server for a connector, or your extension UI.

If you use the SDK to generate boilerplate files for your extension, we’ll automatically add the SDK commands to your package.json, so you can run the standard npm run dev and npm run build commands along with the appropriate flags. For example, npm run dev --open.

Alternatively, you can install the Netlify SDK and then use the commands directly with netlify-extension or the shorthand ntli.

Usage example

All of our docs refer to the package.json scripts to run the SDK commands:

package.json
"scripts": {
"build": "netlify-extension build -a",
"dev": "netlify-extension dev"
},

You can then run the scripts using npm run dev for example, replacing npm with your package manager.

Alternatively, you can use the commands directly in your terminal after you install the Netlify SDK locally:

# If you want to use the commands directly after installing Netlify SDK
netlify-extension build -a
ntli build
netlify-extension dev
ntli dev

Install

If you would like to use the commands in your terminal directly, install the Netlify SDK using your preferred package manager:

pnpm install -g @netlify/sdk

Commands

Make sure your project includes the appropriate scripts

When you use the SDK’s guided set-up flow to create an extension, we automatically add scripts to your project that run the appropriate netlify-extension commands. As a result, all of our docs instruct you to run the package.json scripts instead of the SDK commands directly. If you skipped the guided setup flow, we recommend that you install the Netlify SDK in your project, and manually update your package.json to include scripts for the commands you want to run. For example, "dev": "netlify-extension dev" or "dev": "ntli dev".

build

This builds your extension. By default, it builds all components necessary for your extension to work including any connectors, build event handlers, endpoints, or extension UI.

Flags

FlagTypeDescription
-a, --allbooleanBuild all components of the extension
-c, --connectorbooleanBuild the connector component of the extension
-b, --buildtimebooleanBuild the buildtime component of the extension
-s, --sitebooleanBuild the serverless component of the extension

dev

This builds the exension and watches for changes.

If the extension has extension UI, use this command to preview the UI. The command builds your UI and then runs a server that serves your UI and any handlers you might have.

If you use a connector in your extension, this command also runs a local GraphQL server for your connector that makes it possible to load the GraphiQL UI and test queries locally.

Flags

FlagTypeDescription
-a, --allbooleanBuild all components of the extension
-b, --buildtimebooleanBuild the buildtime component of the extension
-c, --connectorbooleanBuild the connector component of the extension
-o, --openbooleanOpen the extension UI dev server in the Netlify UI
-s, --sitebooleanBuild the serverless component of the extension
--slugstringOverride the extension slug used in the Netlify UI dev preview
--redirectstringA path to redirect to after the Netlify UI dev preview opens

Got it!

Your feedback helps us improve our docs.