Skip to main content

Local development

Use local development when you want to edit a Starlark app in your own editor, keep its source in version control, and preview changes without uploading each draft. Tetra executes the same Starlark rendering model and produces a WebP image that you can inspect locally.

note

This workflow applies to Starlark apps. Develop TypeScript apps with the cloud editor.

Install Tetra

Tetra is available from the public Solidpixels release repository.

macOS

Install Tetra with Homebrew:

brew install solidpixels-inc/solidpixels/tetra
tetra version

Linux

Download the archive for the current CPU architecture and install tetra on your PATH:

case "$(uname -m)" in
x86_64|amd64) tetra_arch="x86_64" ;;
aarch64|arm64) tetra_arch="arm64" ;;
*) echo "Unsupported architecture: $(uname -m)"; exit 1 ;;
esac

archive="tetra_Linux_${tetra_arch}.tar.gz"
curl -fL -o "$archive" \
"https://github.com/solidpixels-inc/tetra-releases/releases/latest/download/$archive"
tar -xzf "$archive"
rm $archive
sudo install -m 0755 tetra /usr/local/bin/tetra
tetra version

Windows

The current Windows build supports 64-bit Intel and AMD processors. Run the following in PowerShell to download Tetra, install it for the current user, and add it to PATH:

$archive = Join-Path $env:TEMP "tetra_Windows_x86_64.zip"
$installDir = Join-Path $env:LOCALAPPDATA "Programs\Tetra"

New-Item -ItemType Directory -Force -Path $installDir | Out-Null
Invoke-WebRequest `
"https://github.com/solidpixels-inc/tetra-releases/releases/latest/download/tetra_Windows_x86_64.zip" `
-OutFile $archive
Expand-Archive -Force -Path $archive -DestinationPath $installDir
Remove-Item -Force $archive

$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
$pathEntries = @($userPath -split ";" | Where-Object { $_ })
if ($pathEntries -notcontains $installDir) {
[Environment]::SetEnvironmentVariable(
"Path",
(($pathEntries + $installDir) -join ";"),
"User"
)
}

$env:Path = "$env:Path;$installDir"
tetra version

Future PowerShell sessions automatically use the updated PATH.

Create an app

Save the following as app.star:

app.star
load("render.star", "render")

def main(config):
message = config.get("message", "Hello, Solidpixels!")
return render.Root(
child = render.Text(message)
)

Every app defines a main function and returns a root render widget. The optional configuration object contains the values passed to the app.

See the widget reference for every layout, text, image, chart, and animation primitive available in Tetra.

Preview while editing

Render the app to a WebP file:

tetra render app.star -o app.webp

Open app.webp in an image viewer. Re-run the command after saving changes to the Starlark source.

Pass configuration values after the script path as name=value arguments:

tetra render app.star "message=Hello" -o app.webp

Move the app to Solidpixels

When the app renders correctly, create an app in the cloud editor and paste in the Starlark source. Run a cloud preview to confirm the production renderer behaves as expected, test it on a device, and submit a version for review.

You can also upload the source and manage releases through the Apps API.