# Install Subbly.js

Subbly.js ships as an npm package and as a browser bundle. Pick one, then
start the SDK with `Subbly.init`.

## Install from npm

```bash title="Install the package"
npm install @subbly/sdk
```

Import it with ES modules. This is the way to use Subbly.js with a modern
JavaScript framework, such as React or Vue. The package ships its own
TypeScript types.

```js title="Start the SDK"
import Subbly from '@subbly/sdk'

const subbly = await Subbly.init({
  apiKey: 'API_KEY',
})
```

`Subbly.init` is the only supported entry point. It loads the shop before it
resolves, so `subbly.shop` is ready when you get the instance. Call it once per
page: the SDK keeps one shared HTTP client, and a second call with a different
key quietly reuses the first one.

## Load from a CDN

The package also ships a browser bundle. Load it on your HTML page and it
defines the global `Subbly`. `window.Subbly` is the class, not an instance, so
you still call `Subbly.init`. Load it once per page.

```html title="Load the script"
<script src="https://cdn.jsdelivr.net/npm/@subbly/sdk"></script>
<script>
  window.Subbly.init({
    apiKey: 'API_KEY'
  }).then((subbly) => {
    // access Subbly SDK methods
  })
</script>
```

## Next steps

- [Configure](/developer-resources/subbly-js-sdk/configure) — every option
  `Subbly.init` takes.
- [Keep it up to date](/developer-resources/subbly-js-sdk/keep-it-up-to-date)
  — pin a version before you go to production.
