Skip to main content
An embedded space runs in a sandboxed frame on Tilde’s spaces host. It gets data only through the project’s ontology, with short-lived tokens for the user your server names. The project’s policies decide whether that user may open the space and what data they see.

Server

Install the server package and mount its handler:
lib/tilde.ts
With Next.js, create app/api/tilde/[...path]/route.ts:
With another framework, pass each request below /api/tilde/ to embed.handle(request). It takes and returns standard Request and Response objects. resolveIdentity must read your verified server session. Return null to refuse the request.

Browser

In React:
Find the environment ID on the project’s Environments tab. The space ID is its folder name under spaces/.

Theme

Pass theme tokens to match your application. Each token takes any CSS value.
Call space.setTheme(theme) to change it later, for example when your app switches to dark mode. The frame sizes itself to its content. Set autoResize: false and height for a fixed size. A space cannot navigate your page itself. Its pages call navigate and emit from @tilde/spaces, and your app decides what happens:
spaces/pipeline/index.tsx
Spaces built before these features were added keep working, without resizing or events. Deploy the project again to rebuild them.

Call the ontology yourself

To render the ontology’s data with your own components, get a token for the user on your server and call the environment’s API:
The token lasts five minutes and carries the same user, groups, and attributes, so the same policies apply.