Platform

Canvas

Create and preview React explainers, editable diagrams, and Markdown notes with CCP.

View as Markdown

Use ccp visualize to create and preview local visual documents. Creating and previewing one doesn't log in, create a cloud App, or publish anything.

Formats

--formatUse it for
explainer (default)An interactive React document edited in source. Explainers don't support companion notes
canvasAn editable diagram stored in diagram.json, with an optional companion note.md
noteA standalone Markdown document stored in note.md

Create and Preview

ccp visualize init ./vector-lab --title "Vector lab"
ccp visualize inspect ./vector-lab
ccp visualize typecheck ./vector-lab
ccp visualize dev ./vector-lab

To start with a diagram or a note instead:

ccp visualize init ./retry-flow --title "Retry flow" --format canvas
ccp visualize init ./release-notes --title "Release notes" --format note
CommandDescription
ccp visualize init <path> --title <title>Create a visual in a new directory. Use --format to choose the format. For explainers, --no-install skips dependency installation. Diagrams and notes don't install npm dependencies
ccp visualize inspect <path>Validate and print the project's metadata as JSON
ccp visualize typecheck <path>Typecheck an explainer with TypeScript, or validate the content files of a diagram or note
ccp visualize dev <path>Run a protected local preview

canvas.json holds a version, a stable random ID, a title, and the visual's format. Don't change the ID when revising an existing visual.

Editing an Explainer

Start with CANVAS.md and src/App.tsx. The starter composes typed Canvas, Section, Columns, Stat, Table, and Callout components from ./canvas-ui. Edit files under src/, extend src/styles.css for figures, and put static assets in public/. Canvas uses plain CSS; Tailwind isn't processed.

The preview doesn't run the server handler, read the project .env, or use your CCP login. Imports must resolve inside src/ or node_modules/, and no package scripts run during preview.

Dependencies install with npm scripts disabled and are kept outside the source folder. If you used --no-install, preview, typecheck, or build installs them when needed.

Interaction State

Use useCanvasState<T>(key, initial) from ./canvas for JSON interaction state that should survive a preview restart; ordinary React state is lost. If another viewer saved first, a stale save refreshes the view and asks you to repeat your edit.

Editing a Diagram or Note

Use the local preview to edit and save a diagram or note. Saves update the source files in the visual directory. If you move or replace that directory while a preview is open, reopen the visual before continuing to edit.

To edit from the CLI, run ccp visualize content <path>. It prints JSON with the current revision and the visual's content.

To replace one part, pass the revision you just read and send the new contents on standard input:

ccp visualize content ./retry-flow
# Replace REVISION with the revision printed above.
ccp visualize content ./retry-flow --part note --revision REVISION < ./companion.md

Use --part diagram with graph JSON (name, nodes, and edges) for an editable canvas, or --part note with Markdown for either an editable canvas or a standalone note. This replaces the named part without changing the other one. If the revision is stale, the command fails without applying the edit. Read the current content before reapplying your changes.

Preview Events

ccp visualize dev always emits the same version 1 JSON events as ccp dev --json. Its startup event is canvas_listening, with data.id and data.url.

Open that exact URL to start the preview session. The URL grants access to the preview, so don't share or publish it. The preview listens only on a local loopback port, so it isn't reachable through another machine's localhost.

Explainer source edits rebuild and reload the preview automatically. build_failed keeps the previous good build, and ready marks a successful rebuild. Process exit is authoritative.

Publishing

Canvas commands never publish. To publish, run ccp visualize typecheck . and then ccp deploy in the visual folder — it builds and deploys like any other App. See Deploying.

Published explainers keep interaction state in each reader's browser; your local state and preview URL aren't uploaded. Published diagrams and notes are read-only snapshots of the saved content at build time, including any companion note. Redeploy to publish later edits.

On this page