Installing the SDK

StackBlitz SDK can be used in any JavaScript project. You can add it to your site using an npm package or with a CDN.

For this tutorial, we will be working with a barebones Vite project and will use npm.

Your task

Let’s start by installing the SDK package. Toggle the terminal on your right and run the following command:

Terminal window
npm install @stackblitz/sdk

After the package is installed, you can import the SDK in your project. In the main.js file add the following import statement at the top:

import sdk from '@stackblitz/sdk';
Files
Preparing Environment
  • Installing dependencies
  • Starting http server