- Updated: March 20, 2026
- 4 min read
Integrating OpenClaw Real‑Time Explainability Dashboard into Moltbook: A Senior Engineer’s Guide
# Integrating OpenClaw Real‑Time Explainability Dashboard into Moltbook
*Published by Ubos Tech – Senior‑Engineer Level Tutorial*
—
## Prerequisites
Before you begin, ensure you have the following:
1. **Ubuntu 22.04 LTS** (or a compatible Linux distribution) with root access.
2. **Docker Engine** (>= 20.10) and **Docker Compose** (>= 2.0) installed.
3. **Node.js** (>= 18) and **npm** for Moltbook development.
4. A **Moltbook** instance running (self‑hosted or SaaS) with admin credentials.
5. **OpenClaw** source repository or pre‑built Docker image.
6. An SSH key pair for secure communication between services.
> **Tip:** Keep all services on the same Docker network to simplify DNS resolution.
—
## 1. Installing OpenClaw
### a. Pull the Docker Image
bash
docker pull ghcr.io/openclaw/openclaw:latest
### b. Create a Docker Compose File (`openclaw-compose.yml`)
yaml
version: “3.8”
services:
openclaw:
image: ghcr.io/openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
– “8080:8080” # Dashboard UI
– “5000:5000” # API endpoint
environment:
– CLW_DB_URL=postgres://openclaw:password@db/openclaw
networks:
– ubos-net
networks:
ubos-net:
driver: bridge
### c. Launch OpenClaw
bash
docker compose -f openclaw-compose.yml up -d
OpenClaw will now be reachable at `http://localhost:8080` (UI) and `http://localhost:5000/api` (REST API).
—
## 2. Exposing the Dashboard API
OpenClaw ships with a built‑in API that returns JSON explanations for model predictions. To make it consumable by Moltbook:
1. **Enable CORS** – edit `openclaw/config.yaml` (or set env var) to allow the Moltbook domain.
yaml
cors:
allowed_origins:
– “https://moltbook.ubos.tech”
2. **Secure the API** – generate an API key from the OpenClaw admin UI and store it in a Docker secret.
bash
echo “YOUR_API_KEY” | docker secret create openclaw_api_key –
3. **Expose via Nginx (optional)** – route `https://api.ubos.tech/openclaw/*` to the container for TLS termination.
nginx
location /openclaw/ {
proxy_pass http://openclaw:5000/;
proxy_set_header X-API-KEY “$http_x_api_key”;
}
Now the API endpoint is publicly reachable at `https://api.ubos.tech/openclaw/v1/explain`.
—
## 3. Embedding the Dashboard as a Moltbook Widget
Moltbook widgets are simple React components that fetch remote data and render it inside a Moltbook page.
### a. Create a New Widget Repository
bash
mkdir moltbook-openclaw-widget && cd moltbook-openclaw-widget
npm init -y
npm install react axios
### b. Implement the Widget (`OpenClawWidget.jsx`)
jsx
import React, { useState, useEffect } from “react”;
import axios from “axios”;
const OpenClawWidget = ({ modelId, inputData }) => {
const [explanation, setExplanation] = useState(null);
const apiKey = process.env.REACT_APP_OPENCLAW_KEY; // set in Moltbook env
useEffect(() => {
const fetchExplanation = async () => {
try {
const resp = await axios.post(
“https://api.ubos.tech/openclaw/v1/explain”,
{ modelId, input: inputData },
{ headers: { “X-API-KEY”: apiKey } }
);
setExplanation(resp.data);
} catch (err) {
console.error(“OpenClaw fetch error”, err);
}
};
fetchExplanation();
}, [modelId, inputData]);
if (!explanation) return
;
return (
Model Explanation
{JSON.stringify(explanation, null, 2)} );
};
export default OpenClawWidget;
### c. Build & Publish the Widget
bash
npm run build
# Copy the build folder into Moltbook’s custom widgets directory
cp -r build /var/www/moltbook/widgets/openclaw
### d. Register the Widget in Moltbook
Add the following entry to `moltbook/config/widgets.json`:
{
“name”: “OpenClawExplainability”,
“path”: “/widgets/openclaw”,
“description”: “Real‑time model explainability powered by OpenClaw”
}
Now editors can insert **OpenClawExplainability** into any page via the Moltbook UI.
—
## 4. Verification Steps
1. **Dashboard UI** – Visit `http://localhost:8080` and confirm the OpenClaw UI loads without errors.
2. **API Test** – Run a curl command:
bash
curl -X POST https://api.ubos.tech/openclaw/v1/explain \
-H “Content-Type: application/json” \
-H “X-API-KEY: YOUR_API_KEY” \
-d ‘{“modelId”:”my‑model”,”input”:{“feature1″:0.7,”feature2”:1.2}}’
Expect a JSON payload with `explanations` and `confidence` fields.
3. **Widget Rendering** – In Moltbook, create a test page, drop the **OpenClawExplainability** widget, configure `modelId` and `inputData`, then publish.
– The widget should display a loading spinner, then render the JSON explanation.
4. **Security Check** – Verify that the API key is never exposed in the browser console (it should be injected server‑side via env vars).
5. **Performance** – Monitor response times with `htop` inside the OpenClaw container; ensure latency stays < 200 ms for typical payloads.
—
## 5. Publishing the Tutorial
The article you are reading is now live on **ubos.tech**. For additional guidance on hosting Moltbot widgets, see the dedicated guide at the internal link below.
[Learn how to host Moltbot widgets]({{"https://ubos.tech/host-moltbot/"}})
—
*Happy coding!*
—
*© 2026 Ubos Tech. All rights reserved.*