Application composition

luastra/app

Composes one transparent host-facing application object from a root contract and optional reusable features. Namespaced event routing and request ownership let independent blocks cooperate without becoming framework-level product widgets.

Give every feature one disjoint lowercase path ID, keep its state inside its module, and claim each asynchronous request before a completion can arrive.

The returned instance still has the ordinary render, handle, resolve, snapshot, and inspect methods; composition does not add a second application lifecycle.

Complete example

local App = require("luastra/app")
local UI = require("luastra/ui")

local count = 0

return App.compose {
    render = function()
        return UI.Screen {
            id = "app",
            UI.Text {
                id = "counter/value",
                text = tostring(count),
            },
        }
    end,
    handle = function(action: string)
        if action == "counter.increment" then count += 1 end
    end,
    snapshot = function()
        return { count = count }
    end,
}

Detail pages

App.ContextApp.FeatureApp.ComposeOptionsApp.DiagnosticsApp.InstanceApp.compose