Embed a live Linux CLI terminal in Fumadocs
Fumadocs powers modern Next.js developer documentation with strict TypeScript MDX components. Embed KilnVM using next/script + mount attributes, kilnvm-react, or an MDX iframe.
1. Add KilnVM to Fumadocs
components/KilnEmbed.tsx (Fumadocs MDX component)
"use client";
export function KilnEmbed({ cmd = "mycli --help" }: { cmd?: string }) {
return (
<iframe
src={`https://kilnvm.dev/embed?project=proj_your_project_id&theme=auto&cmd=${encodeURIComponent(cmd)}`}
title="KilnVM Live Terminal"
style={{ width: "100%", height: "420px", border: 0 }}
allow="clipboard-read; clipboard-write"
referrerPolicy="origin"
loading="lazy"
/>
);
}
2. Seed Files, Run Buttons & Production Tips
content/docs/quickstart.mdx
import { KilnEmbed } from "@/components/KilnEmbed";
Try running your CLI right from docs without installing dependencies:
<KilnEmbed cmd="mycli check ./starter.yaml" />
- Export KilnEmbed in mdx-components.tsx so authors can drop <KilnEmbed cmd="..." /> across any MDX page.
- For multi-file starter projects and clickable tutorial step buttons, load https://kilnvm.dev/kilnvm-embed.js once in your docs layout.
- Keep all production and preview *.vercel.app origins listed cleanly in Allowed Docs Origins during staging.
3. Try a Live Sandbox Right Now
Click Launch Terminal below to boot a real non-root Linux microVM directly in the page.
Frequently Asked Questions
Why choose KilnVM over WebContainers for Fumadocs CLI tutorials?
WebContainers only run Node.js/WASM inside Chrome/Firefox tabs. KilnVM boots native Go, Rust, C++, SQLite, and Python Linux binaries server-side.
Does Fumadocs theme switching work with iframe embeds?
Yes. Pass theme=auto in the iframe URL or use kilnvm-embed.js + window.KilnVMEmbed.setTheme(...) when toggling dark/light mode.
Ready in 5 minutes
Ship live CLI sandboxes inside your docs.
Start free with 300 sessions per month, isolated linux/amd64 microVMs, and zero credit card required.