Packages

PopCraft's npm packages: the popcraft command line, the design kit, the plugin SDK and the runtime exported code shares — what each is for and which to install.

Packages

PopCraft publishes four packages on npm. Each does one job; pick by what you are making.

PackageInstallWhat it is for
@popcraft/clinpm i -g @popcraft/cliThe popcraft command line: edit .popcraft files headlessly, build designs from scripts, render and export, call the REST API, publish to the marketplace, drive the desktop app
@popcraft/kitnpm i @popcraft/kitEverything PopCraft's templates are made with: the Kit and every helper, style system and theme kit, every official template's source, the official build and every check, design scripts, .popcraft files, and the types for an editor
@popcraft/pluginsnpm i -D @popcraft/pluginsThe plugin SDK: the types plugins and widgets are written against
@popcraft/runtimeadded by an exportWhat projects exported as code share: expressions, prototype and state machine players, a site's forms, sign-in and records, and (@popcraft/runtime/commerce) the Next.js Commerce types storefronts bind to

Which one

  • Making designs from a terminal, a script or an AI agent: the CLI. It depends on the kit, so write_design builds with the same code the templates use. Add @popcraft/kit to your project as well for completion and checking while you write design scripts (/// <reference types="@popcraft/kit/design-script" />).
  • Making templates for the gallery: @popcraft/kit beside your sources, and the CLI's popcraft template to build, check, picture and publish them (Making templates).
  • Making designs inside your own program (a build step, a server that makes images, a test): @popcraft/kit. runDesign(script, { size }) runs a design script in a sandbox and returns the document and its checks; toPopcraft(document) gives the file. Rendering a picture or a video needs the app's canvas: hand the file to popcraft run … export.nodes.
  • Extending the editor: @popcraft/plugins, with the plugin guide.
  • Shipping an exported Next.js project: nothing to do; its package.json already asks for @popcraft/runtime.
  • Designing a Shopify store's pages: export them as a storefront: a whole Next.js Commerce store, or components for one (add @popcraft/runtime to it). A Shopify theme is the Ecommerce plugin's.

Examples

Working projects for each package, in getpopcraft/examples: npm install, then run one. They install the published packages, and run against the latest releases every week.

How they fit together

@popcraft/cli ──depends on──▶ @popcraft/kit        (the kit's code and types)
exported project ──depends on──▶ @popcraft/runtime
plugin ──types from──▶ @popcraft/plugins

Everything a package does is also a command in PopCraft itself: the CLI, the editor's agent, plugins and the REST API run the same commands, so a design made one way opens and edits the same everywhere.

For AI agents: Designing with an AI agent is the method, the design reference is the kit by topic with worked examples.