Miraiclip SDK

Introduction

Build video editors, not video editor plumbing.

Miraiclip SDK is a framework-agnostic engine for video editors that run in the browser. You bring the UI. It brings the timeline, the commands, the renderer and the export.

Loading demo…
A small editor built from the SDK's unstyled React components. Drag clips on the timeline or the preview, trim from the edges, play, undo. The full editor runs at react.miraiclip.com.

What you get

Commands, not mutationsEvery edit is a validated, serializable, undoable command.
Undo, redo, transactionsExact history out of the box.
Frame-accurate previewWebCodecs + WebGL: the preview shows the same pixels as the export.
Export anywhereMP4 or WebM in the browser, in a worker, or from Node. No render servers.
Creative toolkitKeyframes, 79 effects, transitions, karaoke captions, HTML clips.
TemplatesOne composition becomes many personalized videos, with batch rendering and a CLI.
AI-nativeLLM tools from the command catalog, an editing assistant, an MCP server.
Any frameworkHeadless core. Use it with React, Vue, Svelte, vanilla JS or Node: see Installation.

What people build with it

Pick your framework

The docs follow the framework picked in the sidebar. Most of the API is the same everywhere. Only the code that binds Miraiclip to your UI changes, and those snippets switch with your choice:

Mount a preview
main.ts
import { createPreviewController } from "@miraiclip/renderer";
import { project } from "./project";

const canvas = document.querySelector<HTMLCanvasElement>("#preview")!;
const button = document.querySelector<HTMLButtonElement>("#play")!;

const preview = createPreviewController(project);
preview.attach(canvas, { width: canvas.clientWidth, height: canvas.clientHeight });

button.addEventListener("click", () => preview.toggle());
preview.subscribe(() => {
  button.textContent = preview.getState().playing ? "Pause" : "Play";
});

// When the view goes away:
// preview.destroy();
Also uses project.ts
project.ts
import { createProject } from "@miraiclip/core";

// One project instance for the whole app. Pass it to components as a prop.
export const project = createProject({ width: 1280, height: 720, fps: 30 });
PreviewPanel.tsx
import { Preview, usePlayback } from "@miraiclip/react";

// Inside <ProjectProvider> and <PlaybackProvider>.
export function PreviewPanel() {
  const { isPlaying, toggle } = usePlayback();
  return (
    <>
      {/* Hands its canvas to <PlaybackProvider>, keeps it sized, releases it on unmount. */}
      <Preview width={640} height={360} />
      <button type="button" onClick={toggle}>
        {isPlaying ? "Pause" : "Play"}
      </button>
    </>
  );
}
PreviewPanel.vue
<script setup lang="ts">
import { onBeforeUnmount, onMounted, shallowRef, useTemplateRef } from "vue";
import type { Project } from "@miraiclip/core";
import { createPreviewController } from "@miraiclip/renderer";

const props = defineProps<{ project: Project }>();
const canvas = useTemplateRef<HTMLCanvasElement>("canvas");

const preview = createPreviewController(props.project);
const state = shallowRef(preview.getState());
const stop = preview.subscribe(() => (state.value = preview.getState()));

onMounted(() => {
  const el = canvas.value!;
  preview.attach(el, { width: el.clientWidth, height: el.clientHeight });
});

onBeforeUnmount(() => {
  stop();
  preview.destroy();
});
</script>

<template>
  <canvas ref="canvas" style="width: 640px; height: 360px" />
  <button @click="preview.toggle()">{{ state.playing ? "Pause" : "Play" }}</button>
</template>
PreviewPanel.svelte
<script lang="ts">
  import type { Project } from "@miraiclip/core";
  import { createPreviewController, type PreviewController } from "@miraiclip/renderer";

  let { project }: { project: Project } = $props();
  let canvas = $state<HTMLCanvasElement>();
  let playing = $state(false);
  let preview: PreviewController | undefined;

  $effect(() => {
    if (!canvas) return;
    const controller = createPreviewController(project);
    preview = controller;
    const stop = controller.subscribe(() => (playing = controller.getState().playing));
    controller.attach(canvas, { width: canvas.clientWidth, height: canvas.clientHeight });
    return () => {
      stop();
      controller.destroy();
      preview = undefined;
    };
  });
</script>

<canvas bind:this={canvas} style="width: 640px; height: 360px"></canvas>
<button onclick={() => preview?.toggle()}>{playing ? "Pause" : "Play"}</button>

Next steps

On this page