Globals
The one program every other program can read from, for state and logic that belongs to the whole app instead of one screen.
Every Xuda project has exactly one Globals program. It holds the constants, shared variables and startup logic that any Component, Get Data, Set Data, Batch, JavaScript or API program in the project can read, so a value that means the same thing everywhere (the signed-in user, a feature flag, the active campus) has exactly one home instead of being copied into every screen that needs it.
Whatever runAt says elsewhere, the runtime forces Globals to client. It is the one program type that never executes on the server, so it is the wrong place for anything that must stay off the device (secrets, privileged reads). Use a server-side Get Data or Set Data program for that.
When to use it
Reach for Globals when a value or a piece of startup logic is needed by more than one Component and you do not want to pass it around as a parameter on every one of them: the signed-in user's name, a selected campus or tenant, a dark-mode flag, a support email address, a raise_event hub that several unrelated screens can listen to.
Do not use it for anything that belongs to a single screen (that is a Component field) or anything that must run server-side.
Properties
The document sits at studio_meta.parentId: "globals", the root of its own branch in the tree, separate from programs, database and routes. A project's Globals document and the tree root cannot be deleted.
progFields
Each entry declares one variable, readable everywhere as @field_id.
System globals are always available alongside your own: @SYS_GLOBAL_OBJ_LOGIN_USER_INFO (the signed-in user object) and @SYS_GLOBAL_OBJ_REFS (elements registered with xu-ref, used for loading and empty states).
progEvents
Globals supports the same progEvents shape as every other program, but not every event type in the platform applies to it. The checker restricts screen_ready, on_refresh, on_unload and client_interval to Components only; declaring one of those on a Globals program is a hard validation error. What Globals actually supports:
An older description of this unit claimed Globals could poll on an interval (client_interval) or on a server cron schedule (server_cron). Neither holds up against the current checker: client_interval is validated as component-only, and server_cron is not a recognized event type at all, its only trace in the runtime is a commented-out handler. If a project needs recurring polling today, put the timer on a Component (client_interval there is real and live) rather than on Globals.
Worked example
Declare the shared state
Add fields for the values every screen needs: selected_campus_v, signed_in_user_v, dark_mode_v.
Read them from anywhere
Any Component, program or expression in the project reads them the same way, with @: @selected_campus_v.
Raise a cross-cutting event
Give Globals a user_defined event (for example campus_changed) and call it with raise_event from whichever Component changes the campus. Every other open Component that also raised a raise_event listener for that name reacts, without a direct reference between the two screens.
In the Studio tree, Globals is the single node at the root of its own branch (not nested under Programs). Open it, add rows to the Fields table for each shared variable with a type and default value, and add rows to Events for on_load / on_exit / any named event, each with its own workflow.