How nexu-io/html-video works
Purpose and entry points
html-video is a local-first monorepo that turns a prompt, article URL, or GitHub repository into an animated MP4. It coordinates a coding agent, template metadata, an engine adapter, and local encoding. Main executable entry point: packages/cli/src/bin.ts; command composition and studio-facing operations live in packages/cli/src/index.ts and packages/cli/src/commands/project.ts.
Project domain and orchestration
Core owns project-domain types, asset handling, engine registration, failures, and optional audio generation/muxing:
• packages/core/src/project.ts
• packages/core/src/registry.ts
• packages/core/src/asset-store.ts
• packages/core/src/minimax.ts
This package is the boundary between project/studio workflows and rendering engines. It should depend on adapter contracts rather than engine-specific implementation.
Agent runtime layer
The runtime abstracts 14 local or API-backed coding agents behind detection, registry, process spawning, and ACP communication:
• packages/runtime/src/detect.ts
• packages/runtime/src/registry.ts
• packages/runtime/src/spawn.ts
• packages/runtime/src/acp-client.ts
Agent definitions under packages/runtime/src/defs/ encode invocation differences (CLI stdin, ACP-over-stdio, or Anthropic API). The CLI/studio selects an available agent, passes fetched source/template context, and consumes its generated storyboard and frame content.
Storyboard and source ingestion flow
The primary path is source → agent → storyboard → rendered frames. URL/repository material is fetched server-side and normalized before agents receive it:
• packages/cli/src/fetch-source.ts
• packages/cli/src/studio-server.ts
The content graph is the engine-independent multi-frame IR, representing nodes and relationships and determining ordered scenes:
• packages/content-graph/src/index.ts
• packages/core/src/types/index.ts
Single-frame work can bypass this storyboard stage. The graph boundary is central: agents create content intent and sequencing; adapters only consume render-ready frame inputs.
Templates as portable render inputs
Templates are self-contained assets with an agent-readable manifest describing intent, inputs, output constraints, and license provenance. The CLI discovers/searches them through:
• packages/cli/src/commands/templates.ts
• templates/frame-data-chart-nyt/template.html-video.yaml
• templates/frame-product-promo-30s/template.html-video.yaml
Most templates are animated HTML sources; some support React/Remotion-style source layouts. Template files are content packages, not application code, and should remain engine-agnostic at the metadata level.
Rendering adapter boundary
Engine adapters implement capability declaration, validation, and rendering under a common conceptual render(input, ctx) contract:
• packages/adapter-hyperframes/src/index.ts
• packages/adapter-hyperframes/src/validate.ts
• packages/adapter-hyperframes/src/render.ts
Hyperframes is the currently material implementation: headless Chromium captures animated HTML, then ffmpeg encodes/concatenates MP4 output. The Remotion adapter exists as a separate integration boundary, including a React bridge:
• packages/adapter-remotion/src/render.ts
• packages/adapter-remotion/src/bridge/Root.tsx
External local dependencies are Node.js, Chromium/Playwright, and ffmpeg/libx264. MiniMax is optional for music and narration, with ffmpeg used for final audio mixing.
User surfaces and runtime topology
The CLI supports diagnostics, engine listing, templates, projects, and starts the local studio server:
• packages/cli/src/commands/doctor.ts
• packages/cli/src/commands/list-engines.ts
• packages/cli/src/studio-server.ts
The shipped browser studio is static client code served locally:
• packages/project-studio/public/index.html
• packages/project-studio/public/app.js
A separate Vite/React studio iteration exists in packages/studio-next/src/App.tsx, but it is distinct from the static studio package. No hosted application or required render service is implied; network use is limited to source retrieval, agent APIs where selected, and optional MiniMax generation.
Main entry points: project.ts Project domain · index.ts Commands and projects · render.ts Hyperframes adapter · studio-server.ts Local studio server
Components 20
Local user surfaces
- CLI executable · Main local command entry point.
packages/cli/src/bin.ts - Commands and projects · Composes project, diagnostics, engine, and template operations.
packages/cli/src/index.ts - Local studio server · Serves studio and fetches source material locally.
packages/cli/src/studio-server.ts - Static browser studio
packages/project-studio/public/app.js - Next studio iteration · Separate from the shipped static studio.
packages/studio-next/src/App.tsx
Project orchestration
- Project domain · Owns projects, assets, failures, and engine-facing workflows.
packages/core/src/project.ts - Engine registry · Registers engines behind engine-independent contracts.
packages/core/src/registry.ts - Asset store
packages/core/src/asset-store.ts - Optional audio generation · Generates music or narration and muxes it with ffmpeg.
packages/core/src/minimax.ts
Agent runtime
- Agent detection · Finds available local or API-backed agents.
packages/runtime/src/detect.ts - Agent registry · Selects invocation behavior across supported agents.
packages/runtime/src/registry.ts - Agent execution · Runs CLI/API agents and communicates over ACP stdio.
packages/runtime/src/acp-client.ts
Content and templates
- Source ingestion · Fetches and normalizes URL or repository material.
packages/cli/src/fetch-source.ts - Content graph IR · Engine-independent nodes, relationships, and ordered scenes.
packages/content-graph/src/index.ts - Template discovery · Searches portable template manifests.
packages/cli/src/commands/templates.ts - Template manifests · Describe intent, inputs, constraints, and provenance.
templates/frame-data-chart-nyt/template.html-video.yaml
Rendering adapters
- Hyperframes adapter · Validates inputs and renders animated HTML frames.
packages/adapter-hyperframes/src/render.ts - Remotion adapter · Separate React-based rendering integration.
packages/adapter-remotion/src/render.ts - Remotion React bridge
packages/adapter-remotion/src/bridge/Root.tsx - Local capture and encode · Chromium captures frames; ffmpeg/libx264 produces MP4.
Connections 23
- CLI executable → Commands and projects: invokes
- Commands and projects → Local studio server: starts
- Local studio server → Static browser studio: serves
- Local studio server → Source ingestion: fetches
- Commands and projects → Project domain: manages projects
- Commands and projects → Template discovery: searches templates
- Template discovery → Template manifests: discovers
- Project domain → Asset store: stores assets
- Source ingestion → Agent detection: provides normalized context
- Agent detection → Agent registry: selects available agent
- Agent registry → Agent execution: configures invocation
- Template manifests → Agent execution: provides template context
- Agent execution → Content graph IR: generates storyboard
- Content graph IR → Project domain: supplies ordered frame intent
- Project domain → Engine registry: resolves engine
- Engine registry → Hyperframes adapter: registers
- Engine registry → Remotion adapter: registers
- Template manifests → Hyperframes adapter: render input
- Content graph IR → Hyperframes adapter: render-ready frames
- Hyperframes adapter → Local capture and encode: captures and encodes
- Remotion adapter → Remotion React bridge: uses
- Project domain → Optional audio generation: optionally generates audio
- Optional audio generation → Local capture and encode: mixes final audio