Real-time Interactive RL Simulation in Your Browser
mjswan is a powerful framework for creating interactive MuJoCo simulations with real-time policy control, running entirely in the browser. Built on top of mujoco wasm, onnxruntime, and three.js, it enables easy sharing of RL simulation demos as static sites, perfect for GitHub Pages hosting.
Check out the demo ― ttktjmt.github.io/mjswan
- 2026-10-01: Released mjswan Cloud 🦢☁️ in open beta 🎉 [X, LinkedIn]
- 2026-08-17: Created mjswan_playground, a collection of mjswan demos
- 2026-08-15: Became mjlab-native, covering most mjlab tasks
- 2026-06-02: Adopted for the MuscleMimic live demo [Demo, X]
- 2026-05-06: Adopted for the GentleHumanoid live demo [Demo, X]
- 2026-04-08: Featured in the MuJoCo README
- Real-time: Run mujoco simulations and policy control in real time.
- Interactive: Change the state of objects by applying forces.
- Cross-platform: Works seamlessly on desktop and mobile devices.
- VR & AR Support: Native WebXR viewer with tracked hands that interact with objects.
- Client-only: All computation runs in the browser. No server for simulation is required.
- Easy Sharing: Host as a static site for effortless demo distribution (e.g., GitHub Pages).
- Portable: Embed the simulation in a web page or Google Colab notebook.
- mjlab-native: Port any mjlab task to the web with the
mjlab-to-mjswanskill. - Customizable: Visualize your mujoco models and onnx policies quickly.
mjswan can be installed with pip:
pip install mjswan # or 'mjswan[dev]', 'mjswan[examples]'or with npm:
npm install mjswanThe demos live in examples/, which the wheel does not ship, so run them with the
mjswan CLI from a clone of this repository (after pip install -e '.[examples]'):
mjswan demo # lists the bundled demos
mjswan demo simple # runs the simple demoThe minimum python script for a sanity check:
import os, mujoco, mjswan
model_path = os.path.join(os.path.dirname(mujoco.__file__), "testdata", "model.xml")
mjspec = mujoco.MjSpec.from_file(model_path)
builder = mjswan.Builder()
builder.add_project(name="Sanity Check").add_scene(name="Test Model", spec=mjspec)
app = builder.build()
app.launch()For detailed instructions, visit the documentation.
This project was greatly inspired by the Facet project demo from the research group at Tsinghua University.
It is also built upon the excellent work of zalo/mujoco_wasm, one of the earliest efforts to run MuJoCo simulations in a browser.
This project is licensed under the Apache-2.0 License. When using mjswan, please retain attribution notices in the app to help other users discover this project.
