Pan, zoom, trace and drill into the diagrams your team and your AI agents keep in Plotwork,
from your repository or your organisation's library, kept current when a new version is published.
Website · Docs · Viewer reference · Vite plugin · API client · Python · Picture contract · Examples

The real component in an app, recorded by pnpm film. Select it to watch on YouTube. New to Plotwork? Watch the product film.
| Question | Answer |
|---|---|
| What is it? | <plotwork-diagram>, a web component, and <PlotworkDiagram> for React, that show any picture the Plotwork engine drew, with the interactions of the Plotwork portal. |
| Where do pictures come from? | A file in your repository, a hosted picture, a stable link, or your organisation's library through an embed link. |
| Does it stay current? | Add live: it checks for a new version every minute while the page is in view, and swaps it in without a reload. |
| What does it install? | Nothing else. No runtime dependencies, React as an optional peer, and every release is published from CI with a signed provenance statement. |
| Does it phone home? | No. It fetches only the address you give it, with no cookie. |
| Can a picture run script in my page? | No. It is shown as an image, and the element never builds markup from text. |
| Private diagrams in an app? | Sign in with Plotwork: your people sign in with their own Plotwork account, and <plotwork-library> and the viewer's token show their diagrams, private ones included, with no API key in the page. |
| Other languages? | Every package is built against spec/, one contract and one set of fixtures for every language. |
A checkout flow in <plotwork-diagram>, with the pointer over Orders API.
npm install @plotwork.official/viewerAny page
<script type="module">
import '@plotwork.official/viewer/register'
</script>
<plotwork-diagram src="/diagrams/checkout.svg" label="Checkout flow"></plotwork-diagram>React
import { PlotworkDiagram } from '@plotwork.official/viewer/react'
export function Architecture() {
return (
<PlotworkDiagram
src="https://cdn.plotwork.dev/l/<your stable link>.svg"
live
onDrill={({ part }) => openPart(part)}
/>
)
}A .diagram file in a Vite app
// vite.config.ts
import { plotwork } from '@plotwork.official/vite'
export default defineConfig({ plugins: [plotwork()] })import checkout from './diagrams/checkout.diagram'
<PlotworkDiagram svg={checkout} />Script the API
import { Plotwork } from '@plotwork.official/sdk'
const plotwork = new Plotwork({ apiKey: process.env.PLOTWORK_API_KEY })
const checked = await plotwork.diagrams.validate({ source })import os
from plotwork import Plotwork
plotwork = Plotwork(api_key=os.environ["PLOTWORK_API_KEY"])
checked = plotwork.diagrams.validate(source=source)Sign in with Plotwork, for an app whose people have Plotwork accounts:
import { Plotwork } from '@plotwork.official/sdk'
import { authorizeUrl, createPkce, exchangeCode, parseRedirect, withRefresh } from '@plotwork.official/sdk/oauth'
import { PlotworkLibrary } from '@plotwork.official/viewer/react'
// Send the person to Plotwork, then trade the code they come back with for their own tokens.
const pkce = await createPkce()
const { url, state } = authorizeUrl({ clientId, redirectUri, scopes: ['library:read'], codeChallenge: pkce.challenge })
const tokens = await exchangeCode({ clientId, code: parseRedirect(location.href, state), redirectUri, codeVerifier: pkce.verifier })
const token = withRefresh(tokens, { clientId, onRefresh: save })
const plotwork = new Plotwork({ accessToken: token })
<PlotworkLibrary token={token} onSelect={({ pictureUrl }) => show(pictureUrl)} />An API key stays on a server; a token from Sign in with Plotwork is the person's own and fine in a browser. The API client has the full server and browser examples, and the Next.js and React and Vite examples run them.
The viewer renders as the bare element on a server and comes alive in the browser. Every attribute, method, event and style hook is in the viewer reference.
Apps to clone, add your API key or app to, and run. Each installs the packages from npm as your project would, and CI builds each against every change.
Next.js Sign in with Plotwork as a confidential app, and a route handler that checks and draws with the API client; no key or token reaches the browser. |
React and Vite A .diagram file bundled at build time with drill and trace events, Sign in with Plotwork with no server, and a playground through the dev server.
|
The vanilla page shows the element with no framework. All three are listed in examples/.
| You want | Use |
|---|---|
| The diagram in your repository, redrawn with the code | The Plotwork command line or GitHub Action writes the SVG; point src at it. |
| The latest published version, without a redeploy | A stable link (cdn.plotwork.dev/l/...) with live. |
| A private diagram from your organisation's library | An embed link (cdn.plotwork.dev/o/...) the owner made for your site, with live. Other sites get a placeholder, and the source is never sent. |
| Exactly one version, refused if it changes | fingerprint="sha256-...". |
The viewer only checks while its page is in view, never more often than every 15 seconds, and a check that fails leaves the diagram on screen.
| Package | Status | What it is |
|---|---|---|
@plotwork.official/viewer |
<plotwork-diagram>, <PlotworkDiagram> for React, <plotwork-library> (/library), a picker of a signed-in person's diagrams, and the core with no element (/core). |
|
@plotwork.official/vite |
import checkout from './checkout.diagram': drawn at build time by the command line and redrawn on save, so no engine reaches the browser. |
|
@plotwork.official/sdk |
Every /v1 operation of the Plotwork API, typed from its OpenAPI document, on fetch alone, and Sign in with Plotwork (/oauth). |
|
plotwork on PyPI |
Every /v1 operation of the Plotwork API from Python, typed from the same OpenAPI document, on the standard library alone, and Sign in with Plotwork (plotwork.oauth). |
| Measure | Where |
|---|---|
| No runtime dependencies in any published package, on npm or PyPI; CI fails if one appears | scripts/check-no-runtime-dependencies.mjs |
| The Python package published only from CI by PyPI trusted publishing, with PEP 740 attestations | .github/workflows/publish-python.yml |
| Published only from CI by npm trusted publishing (OIDC, no token), with a signed provenance statement | .github/workflows/publish.yml |
| Exact versions, frozen lockfile, no install scripts | .npmrc, CI |
| New dependency versions wait a week | pnpm-workspace.yaml, renovate.json |
| Every action pinned to a commit | .github/workflows/ |
Check a release yourself with npm audit signatures after installing it.
git clone git@github.com:plotwork-official/plotwork-sdk.git
cd plotwork-sdk
pnpm install
pnpm checkpnpm shots draws the screenshots above from the real component. The diagrams in this README are Plotwork source in docs/diagrams/, drawn by the command line. The repository follows the engineering standards in .standards/; see CLAUDE.md.
| Page | Why |
|---|---|
| Viewer reference | Attributes, events, theming, content security policy |
| Vite plugin | Importing .diagram files, options, hot reload |
| API client | Every /v1 call, errors, retries, Sign in with Plotwork |
| Python client | The same calls from Python |
| Examples | Next.js, React and Vite, and a plain page |
| Picture contract | What every SDK reads from a picture |
| Editor design | A proposed @plotwork.official/editor: edit a .diagram in a page and see it redrawn |
| Plotwork docs | Writing diagrams, the command line, the MCP server, organisations |
MIT licence. Cloud provider names and icons in diagrams are trademarks of their owners.