Skip to content

Single-File Binary & Embedded Assets

Inspired by go build (with //go:embed) and bun build --compile, Orbita packages your entire project into a single self-contained executable.

How It Works

When you run ob build <entry> --compile:

  1. Orbita collects all .lua, .tyl, .luax, and .tylx files in your project and .ob/packages/.
  2. It collects all static assets matching [embed] in ob.toml as well as any --embed CLI globs.
  3. Everything is packed into a .tar.gz archive alongside metadata (entry point + permissions) and appended to a copy of the ob binary with a magic footer (ORBITA_BUNDLE_V1).
  4. When launched, the compiled binary detects the footer and boots straight from memory — no ob installation or loose source files required on the target machine.

Example

1. Declare [embed] in ob.toml

[package]
name = "my-app"
version = "0.1.0"
entry = "src/app.tyl"

[embed]
include = ["assets/**"]

2. Read assets with ob:embed

-- src/app.tyl
local embed = require("ob:embed")

local template: string = embed.read("assets/index.html")
print(template)

3. Compile and run

ob build src/app.tyl --compile -o dist/my-app
./dist/my-app

Baking Permissions into the Binary

You can pre-grant permissions at compile time:

ob build src/server.luax --compile \
  --allow-net=0.0.0.0:8080 \
  --embed "public/**" \
  -o dist/my-server