Get Started
Installation

Installation

Install

Mirage Engine ships as an ES module with bundled type declarations. three is a peer dependency — install it yourself so your app controls the version.

npm install mirage-engine three

Requirements

RequirementVersionNote
three^0.160.0Peer dependency, not bundled
BrowserWebGL2 + MutationObserver + IntersectionObserverAll evergreen browsers
Module formatESMThe package is "type": "module"
⚠️

Mirage touches window, document and WebGLRenderingContext in its constructor. It cannot run during server-side rendering — see SSR frameworks below.

Verify the install

import { Mirage } from "mirage-engine";
 
const target = document.querySelector("#target") as HTMLElement;
const mirage = new Mirage(target, {});
 
await mirage.start();
console.log(mirage.getCanvas()); // <canvas> injected next to your target

If you see a canvas element logged and your target visually duplicated, the install is working.

SSR frameworks

Import and construct Mirage only on the client.

"use client";
import { useEffect, useRef } from "react";
 
export function MirageLayer() {
  const ref = useRef<HTMLDivElement>(null);
 
  useEffect(() => {
    if (!ref.current) return;
    let mirage: import("mirage-engine").Mirage | undefined;
 
    (async () => {
      const { Mirage } = await import("mirage-engine");
      mirage = new Mirage(ref.current!, { mode: "overlay" });
      await mirage.start();
    })();
 
    return () => mirage?.destroy();
  }, []);
 
  return <div ref={ref}>{/* your normal markup */}</div>;
}

Sub-packages

mirage-engine already bundles everything you need. The internals are also published separately if you want just one piece:

PackageUse it when
@mirage-engine/painterYou want DOM-accurate Three.js materials without the DOM sync
@mirage-engine/dom-trackerYou want the batched DOM observer on its own
@mirage-engine/sandwichYou want DOM layering above a canvas without Mirage
@mirage-engine/coreYou are building your own facade over Engine

Next steps

Continue to the Quick Start.


Mirage Engine — MIT Licensed © 2026 dltldn333