Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@elgato/streamdeck

elgatosf5.6kMIT1.3.1TypeScript support: included

The official Node.js SDK for creating Stream Deck plugins.

elgato, stream deck, plugin, sdk, framework, marketplace, maker

readme

Stream Deck SDK banner

Stream Deck SDK

SDK documentation Elgato homepage Join the Marketplace Makers Discord Stream Deck npm package Build status

Welcome to the Stream Deck SDK — Designed to make creating plugins for Stream Deck easy, the Stream Deck SDK provides everything you need to connect and communicate with Stream Deck app, letting you focus on the fun stuff.

Creating Stream Deck plugins with Node.js requires Node.js v20. When installing Node.js, we recommended using a version manager such as nvm (macOS) or nvm-windows (Windows).

🚀 Quick Start

The Stream Deck CLI provides commands for creating, testing, and bundling your plugins, and is the easiest way to get started building for Stream Deck. You can also learn more about getting started in our documentation.

  1. With Node.js installed, install the CLI.
npm install -g @elgato/cli@latest
  1. Once installed, run the create command to initialize the creation wizard.
streamdeck create

📂 File Structure

After creating a plugin with streamdeck create you'll be provided with a local environment for building a plugin.

/
├── *.sdPlugin/
│   ├── bin/
│   ├── imgs/
│   ├── logs/
│   ├── ui/
│   │   └── increment-counter.html
│   └── manifest.json
├── src/
│   ├── actions/
│   │   └── increment-counter.ts
│   └── plugin.ts
├── package.json
├── rollup.config.mjs
└── tsconfig.json

The package.json provides two scripts for building the plugin.

  • npm run build - builds the plugin.
  • npm run watch - continuously watches for changes, and hot-reloads the plugin after build.

🎛️ Actions

Actions are the star of the show and enable users to interact with your plugin. Actions are represented as classes that inherit from SingletonAction, enabling your plugin to receive events from Stream Deck, for example key down, dial rotate, etc.

The following is an example of an action that listens for the keyDown event, and then sets the title of the source action.

import { action, KeyDownEvent, SingletonAction } from "@elgato/streamdeck";

@action({ UUID: "com.elgato.hello-world.say-hello" })
export class SayHelloAction extends SingletonAction {
    /**
     * Listen for the key down event that occurs when a user presses
     * a Stream Deck button, and change the title of the action.
     */
    async onKeyDown(ev: KeyDownEvent) {
        await ev.action.setTitle("Hello world");
    }
}

🔎 Debugging

Plugins can be debugged using any Node.js debugger, for example Visual Studio Code, Chrome, etc., and by default will have debugging enabled when created with the Stream Deck CLI streamdeck create command.

You can configure debugging within the manifest's Node.js configuration.

{
    // ...
    "Nodejs": {
        "Version": "20",
        "Debug": "enabled"
    },
}

There are four available options when configuring the Debug property within the manifest:

  • "enabled" - the plugin will run with --inspect allowing debuggers to connect.
  • "break" - the plugin will launch with --inspect-brk and will await a debugger attaching before running.
  • string - a collection of CLI arguments supplied to the plugin.
  • undefined - debugging is disabled.

When running the plugin in either debug mode "enabled" or "break", a random available port will be allocated to the debug listener each time the plugin launches. If you wish to listen on a specific port, the Debug value can be set to a string of CLI arguments, for example to listen on port 12345, the Debug value would be --inspect=127.0.0.1:12345.

📖 Further Reading

changelog

Change Log

1.3.1

🐞 Fix

  • Update reading of the manifest to be lazy to improve mocking within tests.

1.3.0

✨ New

  • Add support for serializing enumerable collections.

♻️ Update

  • Improve documentation for profile switching.
  • Update dependencies.

1.2.1

♻️ Update

  • Update @elgato/schemas dependency.

🐞 Fix

  • Fix Node.js engine requirements.

1.2.0

✨ New

  • Add support for Chinese (Traditional).

🐞 Fix

  • Fix types of EventEmitter event arguments.

1.1.0

✨ New

♻️ Update

  • Update SingletonAction.actions to return an Enumerable.

1.0.1

♻️ Update

  • Update minimum allowed log level in production to be DEBUG to assist with debugging (default remains INFO).

1.0.0

✨ New

  • Add action tracking, allowing access to currently visible actions.
    • streamDeck.actions — all visible actions.
    • SingletonAction.actions — visible actions that match the action's UUID.
  • Add setTitle to DialAction, allowing you to set the title of a layout.
  • Add Enumerable class for creating readonly collections.
  • Add device information to Action provided in event arguments.
  • Add iterator helpers to streamDeck.devices and streamDeck.actions.

🐞 Fix

  • Fix missing language support for Korean (ko).
  • Fix TypeScript declaration incorrectly exporting types as classes.

♻️ Update

  • Remove streamDeck.actions.createController in favor of streamDeck.actions.getActionById.
  • Remove Action.sendToPropertyInspector in favour of streamDeck.ui.current.sendToPropertyInspector.
  • Remove ev.deviceId in favour of ev.action.device.id.
  • Rename onDidConnect to onConnected within the UI.

⬆️ Upgrading

  • For information on breaking changes, and migrating to the this version, read more about upgrading to v1.0.0.

0.4.0-beta

✨ New

  • Package can now be imported in both Node.js and the browser (in the scope of a property inspector).
  • Add support for property inspector.
    • Add streamDeck.onDidConnect event listener.
    • Add streamDeck.settings namespace for interacting with settings.
    • Add streamDeck.system namespace for system-related operations.
    • Add streamDeck.plugin namespace for bi-direction communication with the plugin and the UI.
  • Add isInMultiAction to the property inspector's action information.

🐞 Fix

  • Coordinates type could erroneously have a non-number type for row.
  • Fix support for allowed types within payloads.
  • Fix localization lookup to index from Localization.
  • Fix race condition when tracking the property inspector.
  • Fix streamDeck.setGlobalSettings to require settings that extend JsonObject.

♻️ Update

  • Update layout and manifest references to propagate from @elgato/schemas.
  • Localization lookup will now return the key if the resource is not defined.
  • Update structure of JSON localizations.
  • Update State type to allow for more than two states.
  • Update routing to prevent exposure of internal messages.
  • Update build to export Stream Deck API types.
  • Update ws dependency.

⬆️ Upgrading

  • For information on breaking changes, and migrating to the this version, read more about upgrading to v0.4.0.

0.3.0

✨ New

  • Add cross-compatible event emitter with type support.
  • Add pattern validation for manifest's Version.
  • Add validation of colors defined within the manifest.

🐞 Fix

  • Fix PayloadObject not being exported; enables inheritance of actions.
  • Fix manifest layout not allowing $A0 as a pre-defined value.

♻️ Update

  • Update manifest file path validation to prevent referencing a file outside of the plugin directory.
  • Update manifest file path validation to allow periods.
  • Update manifest UUID validation to allow more than 3 segments.
  • Update manifest UUID validation to prevent underscores.
  • Update documentation of Actions[].Image to reflect support for .gif files.
  • Update default export to be named (improving VSCode intellisense).

🗑️ Remove

  • Remove $A2 incorrectly being listed as a pre-defined layout.

0.2.0

✨ New

Stream Deck 6.5

  • Add support for receiving messages via deep-linking.
    • URL format: streamdeck://plugins/message/<PLUGIN_UUID>/<MESSAGE>
    • Accessible as part of the system namespace, streamDeck.system.onDidReceiveDeepLink
  • Add support for switching to a specific profile page when calling switchToProfile.
  • Add controller information to WillAppear and WillDisappear events for multi-actions.
  • Add support for Node.js plugins with the .cjs or .mjs file extensions.

Node.js SDK

  • Add profiles, settings, system, and ui namespaces.
  • Add streamDeck.actions.createController(id) to enable the control of a contextualized action.
  • Add streamDeck.devices.getDeviceBy(deviceId) to enable the selection of a device by identifier.
  • Add length, forEach, and [Symbol.iterator] to streamDeck.devices to enable iteration.

♻️ Improvements

  • Refactor streamDeck.devices to namespace.
  • Update manifest JSON schema to support Stream Deck 6.5.
  • Improve enum support in manifest and layout JSON schemas.
  • Node.js runtime updated to v20.8.1.

🐞 Bug Fixes

  • Correctly validate paths without extensions in manifest JSON schema.
  • Default text-overflow set to ellipsis in layout JSON schema.

⬆️ Upgrading

  • For information on breaking changes, and migrating to the this version, read more about upgrading to v0.2.0.

0.1.0

✨ New

  • Add Stream Deck communication client (see streamDeck.client).
  • Add support for receiving all events (Stream Deck 6.4).
  • Add support for sending all commands (Stream Deck 6.4).
  • Add action routing (see streamDeck.actions).
  • Add centralized device information tracking (see streamDeck.devices).
  • Add local file-based logging framework (see streamDeck.logger).
  • Add localization support (see streamDeck.i18n).
  • Add manifest information (see streamDeck.manifest).
  • Add Stream Deck and plugin information (see streamDeck.info).