Skip to main content

Building for Roku

Create an application with Getting started and run it in the browser before preparing hardware. Roku compilation uses the @tantawowa/hsc npm dependency selected by the app's package.json and lockfile.

Check the compiler​

Roku delivery lane from Hosanna compilation into BrightScript, SceneGraph XML, package signing, certification, and channel releaseRoku delivery lane from Hosanna compilation into BrightScript, SceneGraph XML, package signing, certification, and channel release

Restore the application dependencies, including the native compiler, and check the installation. No license key is required. See Hosanna Compiler and Tool Setup if an older application does not yet declare @tantawowa/hsc.

npm ci
npx hsc --version
npx hst doctor

Prepare a device​

  1. Enable developer mode using Roku's developer setup guide. Keep the device IP and the installer password you create.
  2. Make the Roku reachable from your development machine. If you use a shared lab device, reserve it through your team's Device Deck workflow before deploying. HST discovery does not reserve hardware.
  3. Supply the installer password as ROKU_DEVPASSWORD through your local environment or secret manager. Do not put it in a reusable command or commit it.

For an interactive macOS zsh terminal, enter the password without echoing it:

read -rs 'ROKU_DEVPASSWORD?Roku installer password: '
printf '\n'
export ROKU_DEVPASSWORD

In Bash, use:

read -r -s -p 'Roku installer password: ' ROKU_DEVPASSWORD
printf '\n'
export ROKU_DEVPASSWORD

Discover devices, or pass a reachable IP directly to --device:

npx hst target:list --platform roku
npx hst device:list --type roku

To save a device name, create an ignored .hosanna-tools/devices.json in the app or ~/.hosanna-tools/devices.json for your user. Replace the example IP with your device's address:

{
"devices": [
{
"name": "My Roku",
"type": "roku",
"ip": "192.168.1.50",
"default": true
}
]
}

The inventory supports a password field, but ROKU_DEVPASSWORD takes precedence. Keep credentials and machine-specific inventory outside version control.

Build and deploy​

The app and game starters supply these commands:

npm run build:roku
npm run run:roku -- --device "My Roku"

They use hst build roku dev device and hst run roku dev device. The run command builds, deploys the app and streams logs. Select the same device by IP if you did not save a name. A Roku holds one sideloaded development app, so deploying replaces the previous development app on that device.

Inspect the selected application, compiler project and device before deploying:

npx hst run roku dev device --device "My Roku" --dry-run --explain

hst build roku dev device resolves assets/meta/build-config.json, resolves the project compiler, and runs the selected Roku hsconfig file. Use --hsc-project when the repo has explicit dev/prod files:

npx hst build roku prod device --hsc-project platforms/hsconfig-roku.prod.json

hst run roku dev device builds when needed, deploys to the selected Roku, and streams logs unless you pass --no-logs. If you have already built and only need to redeploy generated output, use:

npx hst run roku dev device --no-build --source-root platforms/roku/src --device "Living Room Roku"

A component-library project uses npm run package:roku and its plain consumer instead of the app run commands. See Roku component libraries.

Debugging​

Use breakpoints for debugging. Errors and crashes appear in the console, synced with source maps.

Hosanna debugger Chrome extension​

This extension lets you inspect a Roku application from Chrome and modify supported runtime state in real time. It works with a Roku device target and with a Roku platform expression running in the Hosanna browser runtime.

To use the Hosanna debugger extension:

  1. Install the Hosanna debugger extension from the Chrome Web Store.
  2. Start the debug proxy:
    npx hst debugger:start
  3. Configure the IP address of the machine where you ran the debugger in an explicit build-config profile, for example build-config/profiles/local-debug.json, then run with --profile local-debug:
    npx hst run roku dev device --profile local-debug --device "Living Room Roku"

Limitations​

  • BrightScript REPL uses m instead of this.

  • BrightScript debugger is slow and crash-prone.

  • Transpiled code may differ (e.g., thing.get_foo() instead of thing.foo)

  • Here are some helpful tips:

    • Use get_foo() for getters
    • Use set_foo(value) for setters
    • Use getField('name') for state values, or observable fields

Struct Generator​

Hosanna UI uses a custom generator to create boilerplate code for views, tasks, and components. This generator ensures consistency, reduces manual coding effort, and helps you follow best practices.

The generator produces "struct" files that:

  • Define state fields and methods for each Hosanna component.
  • Create utility methods for easy, declarative instantiation of components.
  • Help maintain type safety and code clarity.

How to use the generator:

  • Generate structs and command maps:
    npx hst generate:all
  • Remove generated files:
    npx hst generate:clean

Note: If you run npx hst run browser dev emulator, Hosanna Tools starts the generator/debugger services used by the browser development loop. You do not need to start a separate IDE task for normal browser development.

For more details on struct files and advanced usage, see the dedicated documentation in the guides section.

Talk to us