AI agent getting started? Read Agents: start here first.
Chrome only: Hosted apps run only in the Google Chrome versions the platform has tested and supports. The major version immediately above the highest supported version also runs and logs a warning. Other Chrome versions and other browsers are refused.
A hosted app is a React component that you publish into a project. People open it from the project’s list of hosted apps, and it runs inside the workspace in a sandbox. It reads and changes engineering data through the same typed operations as the rest of the platform, and it acts with the authority of the person who opened it.
Hosted apps are the recommended way to build new applications in OpenEngineering. They offer the richest experience, with custom React interfaces and interactions. For a simpler workflow using existing view components, you can use configured app pages.
To host an app on your own infrastructure instead, see Host your own app.
Setup and access
Section titled “Setup and access”You need a project where you may publish hosted apps, a signed-in CLI, and Node.js tooling to build a browser bundle. Install esbuild in your app project. Use a supported Chrome version to open the result.
The runtime supplies the viewer’s authenticated client. Your bundle does not manage an access token or ask the viewer to sign in again.
Write the entry point
Section titled “Write the entry point”Export one component that takes { client }, and start it with one call, as the last top-level statement of the bundle. The hosted-app developer SDK package @openengio/hosted-app, which wraps that call as mount(App) and types the component, is not published yet. Until it is, call the runtime directly:
declare const __oe2HostedApp: { React: typeof import("react"); mount(App: (props: { client: unknown }) => unknown): void;};
const { createElement, useState } = __oe2HostedApp.React;
function App() { const [count, setCount] = useState(0); return createElement("button", { onClick: () => setCount(count + 1) }, `Clicked ${count}`);}
__oe2HostedApp.mount(App);The runtime supplies React and its renderer, so the bundle holds only your own code. Build it as one classic script. The component receives the client as its only prop; the next section describes it.
For example, with esbuild installed in your app project, bundle a file that exports App and
calls __oe2HostedApp.mount(App) once:
npx esbuild app.ts --bundle --format=iife --global-name=AppBundle --platform=browser --target=es2020 --outfile=dist/app.jsThe bundle must call the runtime’s mount function at top level; publish the resulting dist/app.js.
Check the first result
Section titled “Check the first result”After building the script above, publish it and open its page. The button should show Clicked 0 and increment when pressed. This first example checks the runtime without changing engineering data. Add a client read only after it works.
The SDK client and the routes an app may call
Section titled “The SDK client and the routes an app may call”The client is the platform SDK, built by the runtime over a restricted channel to the host. An app has no second API and no token of its own. The client carries three modules as one flat client, as the example below shows:
For example, read an object with await client.readObject({ selector: { projectId, ref }, input: { objectId } }).
| Module | The app can |
|---|---|
| Objects | Query, aggregate and read objects, follow relationships, structures and paths, read history and the published catalogue of type and view definitions; change objects singly or in a batch; run verbs (operations defined by object types); save named object sets (saved, named selections of objects); and read and add comments and subscriptions |
| Branches | List branches, read a branch’s head, history and differences, and read merge conflicts and proposals (branch merge requests) |
| Administration | List the project’s and the organisation’s members, search people, and read what the viewer may do |
An app can call a route only when the platform has admitted that route for hosted apps. Every other route is refused, and a call outside the admitted set is refused even if the viewer could make it from the CLI. Attachments and other binary routes are not admitted.
The scope an app acts with
Section titled “The scope an app acts with”An app acts as the person who opened it, in the organisation and project they opened it from. Every operation the app makes is checked against that person’s permissions, so an app never reads or changes anything the person could not. Project and branch protection still apply to its writes.
An app runs with a token minted for one launch, an app execution session. Audit records identify the launch. This distinguishes a hosted-app change from one made directly by the person. Revoking the app or its version ends the session at the next call.
Open an app only if you trust its author. With standard isolation, the sandbox stops an app from sending data out of the browser, but it cannot stop an app from copying data inside the platform. The app can read anything the person who opens it can read. It can then write that data to a place its author can read, for example an object in a project where the author is a member. The platform cannot tell such a write from an ordinary one. Every write is still checked against the viewer’s permissions, and audit records name the launch that made it, so you can trace it afterwards. Before you open an app, check who published it. For each new version, review its code or have a coding agent review it.
What an app can draw
Section titled “What an app can draw”The app sends complete element trees to a trusted renderer, which checks every element. The vocabulary is closed:
- Elements for layout and text:
article,aside,div,em,footer,h1toh3,header,li,main,nav,ol,p,section,small,span,strongandul. - Form controls:
button,input,label,option,selectandtextarea, withclick,inputandchangeevents that return bounded scalar values. - A closed set of style properties and a closed stylesheet grammar for class rules.
- A closed subset of SVG for charts.
- A
canvasthat the app draws on with anOffscreenCanvasand the trusted renderer shows as pixels.
The trusted renderer admits no URL-bearing or executable attribute: no href, src, style string or inline script. If an app sends an unsupported structure, the trusted renderer stops the app rather than repairing it.
Publish the bundle
Section titled “Publish the bundle”Publish a built bundle into a project under a key. The key is lower-case letters, digits and hyphens, and it names the app inside the project.
openeng hosted-app publish ./dist/app.js --project <project id> --key rover-dashboardThe command creates the app when the project has none under that key, and each later publish adds the next version. It prints the version identifier, the bundle’s SHA-256 and its size. A bundle is at most 4 MiB. A person who may not publish into the project is refused.
List the project’s apps and an app’s versions:
openeng hosted-app list --project <project id>openeng hosted-app versions rover-dashboard --project <project id>Revoke an app after you finish using it:
openeng hosted-app revoke rover-dashboard --project <project id>Pass a version identifier instead of an app key to revoke one version. A revoked version, and every version of a revoked app, can no longer be opened. Anyone with it open sees “This app was revoked.” at the app’s next call.
Find the app in the workspace
Section titled “Find the app in the workspace”Open Admin, then Hosted apps, to list a project’s apps. Each app has its own page in the
workspace. The page shows who published the open version, its hash and when it was published, so you know what code you are running before you use it. The key hosted is
reserved and cannot name an app document (the named page entry for an app).
Standard and reduced isolation
Section titled “Standard and reduced isolation”Standard isolation runs the app in a Worker inside a sandboxed frame. The Worker has no page access and no network. In Admin → Hosted apps, only an organisation owner can switch on reduced isolation. With reduced isolation, the app runs in the sandboxed frame’s own window, so it can use React normally. That window cannot block WebRTC connections. An owner or maintainer can grant reduced isolation to an app. These controls appear when the deployment supports this runtime.
When an app has reduced isolation permission, openeng hosted-app publish prints this warning after the version line, and the app’s pages show it:
Reduced isolation lets an app use React in the normal way, so agents can build better apps. One browser feature, WebRTC, cannot be blocked which creates a security risk if used by a hosted app. WebRTC lets a web page connect directly to other computers on the internet, for example for video calls. An app with reduced isolation could use WebRTC to send data out of the viewer’s browser. The app runs with the access of each person who opens it, so this data could be anything that person can read. Use of WebRTC in an app with reduced isolation is a security risk. Review the app’s code for WebRTC use before you allow it, and again for each new version. A coding agent can do the review. If you remove this permission, the app stops at its next request, but data it already read cannot be recalled.
If the account that publishes cannot read the organisation’s reduced isolation settings, the command still publishes and prints a line saying so instead: ask an administrator to check the app’s permission.
The permission names the app, not a version, so it holds for every later version until an administrator withdraws it. Switching the organisation setting off withdraws every app’s permission.
Use the workspace or CLI for attachments; binary routes are not admitted for hosted apps.