Open-source web UI for TMs managed by a TMC instance. The TMC instance URL is defined in the Settings page. The initial goal is to support only GET requests in the UI; this is not a CLI replicated in the browser.
- Node.js >= 22.20.0
- Yarn
If you wish to have a local setup, you only need to have the setup-local.sh file, deploy.sh file, a .env file and the ci-cd folder in the current folder.
Edit the .env file, and then run:
sh setup-local.sh
It will automatically install, build and give a preview of the current application.
The setup-local.sh script does the following:
- Checks that Node.js
>= 22.20.0is installed. - Checks whether Yarn is available.
- Runs
deploy.shonly when the project files or catalog files still need to be prepared. - Runs
yarn install && yarn build && yarn preview.
This UI can be deployed as a static site or with a backend server using GitHub Pages or GitLab Pages.
The deployment preparation flow is handled by deploy.sh. It reads the deployment settings defined in a .env file, ensures the application source is available, fetches the catalog when needed, validates the required files, and updates vite.config.mjs according to the selected deployment mode.
Inside the ci-cd folder are the files used by deploy.sh.
editConfig.shfetchRepository.shvalidateRequiredFiles.sh
Create a .env file at the repository root before running the script:
APP_REPO_URL=https://github.com/<user_or_org>/<tmc-ui-repository>.git
CATALOG_REPO_URL=https://github.com/<user_or_org>/<catalog-repository>.git
SERVER_AVAILABLE=false
Variables:
APP_REPO_URL: repository that contains the TMC UI source code. This is only used when the current workspace does not already containpackage.jsonandsrc.CATALOG_REPO_URL: repository that contains the catalog content to be copied intopublic.SERVER_AVAILABLE: must be eithertrueorfalse.false: the UI is prepared as a static deployment and reads catalog files from the contents copied intopublictrue: the UI is prepared to work with a backend server, and the build configuration is updated accordingly
Run the deployment preparation step with:
sh deploy.sh
The script performs the following steps:
- Loads variables from
.envif the file exists. - Checks whether the current workspace already contains the UI source.
- If the UI source is missing, clones the repository defined in
APP_REPO_URLinto a temporary folder and copies its contents into the working directory. - Verifies that the
publicdirectory exists. - If
public/.tmcalready exists, skips the catalog download. - Otherwise, clones the repository defined in
CATALOG_REPO_URLinto a temporary folder and copies its contents intopublic. - Validates that the catalog contains all required files under
.tmc. - Updates
vite.config.mjssoSERVER_AVAILABLEmatches the selected deployment mode.
If .env is not present, deploy.sh falls back to these defaults:
APP_REPO_URL=https://github.com/wot-oss/tmc-ui.git
CATALOG_REPO_URL=https://github.com/wot-oss/example-catalog.git
SERVER_AVAILABLE=false
- Set up GitHub Pages under Settings -> Environments -> github-pages
- Under Deployment branches, select the branch that should publish the site
Detailed documentation is available here.
The GitHub Pages workflow for this repository is defined in .github/workflows/fetch-files.yml.
The catalog repository must contain a .tmc directory at its root.
Inside .tmc, the following files are required:
tm-catalog.toc.jsontmnames.txtmpns.txtmanufacturers.txt
Notes:
- The catalog validation step fails if any of the required files are missing.
- The helper script removes
.git,.gitignore,.github, andREADME.mdfrom downloaded repositories before copying them into the workspace. SERVER_AVAILABLEonly accepts the valuestrueorfalse.
The connection to a backend server that provides the catalog can be configured by adding the following variables to the .env file:
VITE_API_HOST=
VITE_API_PORT=
VITE_API_PROTOCOL=
Or you can use the export command before running the application:
export VITE_API_HOST=some_value
If no .env file is defined, the default value will be:
http://localhost:8080
Based on the previous sections, the .env file can have the following structure:
VITE_API_HOST=
VITE_API_PORT=
VITE_API_PROTOCOL=
APP_REPO_URL=
CATALOG_REPO_URL=
SERVER_AVAILABLE
VITE_EDITDOR_URL=https://eclipse-editdor.github.io/editdor/
VITE_PLAYGROUND_URL=https://playground.thingweb.io/
VITE_EDITDOR_URL and VITE_PLAYGROUND_URL are used to configure the application behavior when the user wants to open the Thing Description in another application for editing and validation. The value of each variable defaults to the value shown above when the variable is not present in the .env file.
These two options are displayed in the Details page.
The Open with action can integrate with an external application by using window.postMessage.
When the user clicks Open with and chooses the application configured through VITE_EDITDOR_URL, the UI opens that application in a new window and waits for a ready message from it.
To support this flow, the receiving application must implement the following handshake:
-
After the external application finishes loading, it must send a message to the opener window:
window.opener?.postMessage({ type: 'EDITDOR_READY' }, '');
-
After that message is received, this UI sends a second message back to the external application window with the Thing Description content:
{ type: 'LOAD_TD', description: '', payload: '' }
Message fields:
type: message identifier.description: Thing Description title when available, otherwise the Thing Descriptionid.payload: the full Thing Description serialized as formatted JSON.
The receiving application must listen for the LOAD_TD message and parse payload as JSON before loading it into its editor.
Security recommendations:
- Validate
event.originbefore accepting messages. - Reply only to the opener window that created the external application window.
- Use the origin part of the configured URLs when calling
postMessage, not the full URL including the path.
The UI waits up to 10 seconds for the EDITDOR_READY message. If no ready message is received within that time, the action is marked as failed.
Run to check the code style for errors:
yarn format:check
To format and fix the errors:
yarn format
Customize the colors of the UI by editing CSS variables in src/theme.css. The light theme is defined under selector :root, and the dark theme under .dark. If you delete any of the defined variables, the default values will be used. All color values must be specified in hexadecimal format.
Variables (edit in src/theme.css):
- Background
--background-primary-navbar: navbar background (logo + page title area)--background-secondary-navbar: navbar shadow/accent--background-body-primary: page background of the page body shared by all the pages--background-body-secondary: panels/cards background
- Inputs are all areas that can receive user inputs such as text.
--input-background: input field background--input-main: input main color--input-on-hover: input background on hover--input-text: input text color--input-on-focus: input ring/background on focus
- Buttons are all areas that have an action
--button-primary: primary button background--button-on-hover: button background on hover--button-on-click: button background on click--button-border: button border color--button-focus: focus outline color
- Border of elements
--border-on-hover: generic border on hover--border: generic border
- Text colors
--text-on-hover: text color on hover--text-white: white text--text-gray: gray text--text-label: label text--text-value: value text--text-highlight: highlight background (e.g., badges)--success: success color--error: error color
