Installation
Add the core and the renderer to your app.
npm install @miraiclip/core @miraiclip/renderer| Package | Runs in | What it does |
|---|---|---|
@miraiclip/core | Browser, worker, Node | State, commands, history, events, AI tools |
@miraiclip/renderer | Browser | Playback, preview, stills and export (WebCodecs + WebGL) |
Optional packages:
| Package | Add it for |
|---|---|
@miraiclip/server-export | Exporting from Node, plus a CLI |
@miraiclip/templates | Parameterized videos and batch rendering |
@miraiclip/audio-sources | Stock and AI-generated audio with licenses |
@miraiclip/assistant | An AI editing assistant, any model |
@miraiclip/mcp | An MCP server for agents |
Editor UI packages:
| Package | Add it for |
|---|---|
@miraiclip/editor | Timeline maths, clip drag and trim with snapping, preview transforms, shortcuts, placement. No framework; see Headless editor logic |
@miraiclip/react | Providers, hooks and unstyled components for React; see React and Components |
Framework setup
No extra setup. Import from @miraiclip/core and @miraiclip/renderer in any ES module. Add @miraiclip/editor for timeline drag, snapping and shortcuts.
Install @miraiclip/react and wrap the editor in ProjectProvider and PlaybackProvider; hooks such as useClips and usePlayback, and components such as <Timeline.*> and <Preview>, read from them. See React and Components.
npm install @miraiclip/reactNo adapter is needed. Create the project once, pass it down as a prop, and mirror the slices you render into shallowRefs. See Reading state. @miraiclip/editor covers timeline drag, snapping and shortcuts; a @miraiclip/vue package with composables is planned.
No adapter is needed. Create the project once, pass it down as a prop, and mirror the slices you render into $state inside an $effect. See Reading state. @miraiclip/editor covers timeline drag, snapping and shortcuts; a @miraiclip/svelte package is planned.
Using Vite
Add this to vite.config.ts. The export worker loads the renderer's dependencies on its own, and without it the worker fails to start in vite dev:
import { defineConfig } from "vite";
export default defineConfig({
optimizeDeps: {
exclude: ["@miraiclip/renderer"],
include: ["@miraiclip/renderer > pixi.js", "@miraiclip/renderer > mediabunny"],
},
});For exports in a worker, load the worker with Vite's ?worker import: see Web worker › Vite. Tested with Vite 8.
Requirements
- Preview needs WebCodecs and WebGL: Chrome and Edge 94+, Safari 16.4+, Firefox 130+. Browser export also needs the encoders: MP4 needs Chrome or Edge (free Chromium builds have no H.264 encoder), WebM needs any Chromium browser. Export checks before it starts. See Compatibility.
- The renderer is browser-only. Load it on the client only in SSR frameworks (Next.js, Nuxt, SvelteKit).
- Times are in microseconds: 1 second = 1,000,000 µs.