Next.js

No config needed: the package marks itself as a client component and is safe to render on the server.

App Router

// app/edit/[id]/editor.tsx
'use client';

import { VideoEditor, type Project } from '@video-ultra/react';
import '@video-ultra/react/styles.css';
import { saveProject } from './actions';

export function Editor({ id, project }: { id: string; project: Project | null }) {
  return (
    <div style={{ height: '100dvh' }}>
      <VideoEditor
        initialProject={project ?? undefined}
        onSave={(p) => saveProject(id, p)}
      />
    </div>
  );
}
// app/edit/[id]/actions.ts
'use server';

import type { Project } from '@video-ultra/core';

export async function saveProject(id: string, project: Project) {
  await db.projects.update(id, { json: JSON.stringify(project) });
}
// app/edit/[id]/page.tsx (a server component)
import { parseProject } from '@video-ultra/core';
import { Editor } from './editor';

export default async function Page({ params }: { params: Promise<{ id: string }> }) {
  const { id } = await params;
  const row = await db.projects.get(id);
  const parsed = row ? parseProject(row.json) : null; // validates, migrates old files
  return <Editor id={id} project={parsed?.ok ? parsed.project : null} />;
}

@video-ultra/core works on the server too: parseProject checks and upgrades a saved project, and the edit operations (insertMain, updateItem, …) build or change projects without a browser.

A complete app (a server component loading the project, a server action saving it) is in apps/examples/nextjs in the repository.

Pages Router

The same component works in a page; import the stylesheet in that page or in _app.tsx.