Introducing a new way to review your PRs.

Read the announcement

chakra-ui / panda

🐼 Universal, Type-Safe, CSS-in-JS Framework for Design Systems ⚡️

View on GitHub

19 documents · Updated Sep 23, 2026

docs / developer-tooling

Developer tooling and build integration

Panda provides three related entrypoints for turning project style usage into build output: the panda command, the Node API, and the PostCSS plugin. They share configuration and compiler behavior, but fit different build owners. The command is the direct project workflow, Node lets another tool control Panda, and PostCSS lets a stylesheet pipeline trigger Panda during CSS processing.

Entry points

The developer tooling layer connects application source and CSS build steps to the Panda compiler. Each entrypoint starts from the same project configuration and produces the generated style system or CSS that an application can consume.

Entry pointBuild ownerMain use
CLIA developer or package scriptInitialize a project, generate output, watch source changes, inspect results, and run build tasks
Node APIAn application or build toolLoad Panda in code and coordinate generation as part of a custom process
PostCSS pluginA PostCSS-based build pipelineProcess a Panda entry stylesheet and append the CSS generated from the project

The CLI package exposes both panda and pandacss commands through @pandacss/dev. Its commands use the Node package as the execution layer, so direct commands and programmatic builds share the same project context rather than forming separate compilers. References: packages/…/package.json• L1-35, packages/…/cli-main.ts• L1-22

Build lifecycle

Every entrypoint resolves a project context before it generates output. The context joins the Panda configuration with the source files and dependencies that the build must track. This gives one stable contract across one-off builds, watch mode, and stylesheet processing.

When a build runs, it follows this broad sequence:

  1. Resolve the project directory and Panda configuration.
  2. Load or refresh the shared compiler context.
  3. Read the configured source and collect Panda style usage.
  4. Generate the requested style-system or CSS output.
  5. Keep dependent build steps informed when watched files or configuration change.

The following diagram shows how the supported entrypoints meet at the shared build context.

flowchart LR
  Source[Application source and config]
  CLI[CLI command]
  Node[Node API]
  PostCSS[PostCSS plugin]
  Context[Shared Panda build context]
  Output[Generated style system or CSS]
  Pipeline[Application build pipeline]

  Source --> CLI
  Source --> Node
  Source --> PostCSS
  CLI --> Context
  Node --> Context
  PostCSS --> Context
  Context --> Output
  Output --> Pipeline

The Node runtime supplies file access, path handling, source discovery, and file watching for these build paths. Watch mode can then react to source or configuration changes instead of requiring a new process for each update. References: packages/…/node-runtime.ts• L10-81, packages/…/builder.ts• L20-119, packages/…/index.ts• L1-15

Command workflows

The CLI is the supported entrypoint for normal project setup and direct build control. The default command generates the project style output, while focused commands support setup, code generation, CSS generation, watching, analysis, debugging, build information, and package entrypoints.

Use the CLI when the package script or developer should own the build process. Its watch flows keep a Panda context alive and refresh generated output after relevant source or configuration changes. See CLI workflows for the command-level lifecycle and choices.

References: packages/…/cli-main.ts• L40-174 packages/…/cli-main.ts• L176-310 packages/…/cli-main.ts• L388-634

Programmatic and stylesheet integration

The Node API is the programmatic surface for build tools that need to control Panda without invoking a shell command. It exposes context loading and build operations, plus a builder used by stylesheet integration to reuse the same state across processing steps.

The PostCSS plugin is the stylesheet-facing surface. It accepts a CSS file that declares Panda layers, checks whether the file is a valid Panda entry, then extracts project usage and writes generated Panda CSS into that PostCSS root. It also reports source and configuration dependencies to the surrounding pipeline, which lets a build tool rebuild when Panda inputs change.

The plugin skips non-CSS inputs and dependencies under node_modules by default. An allow list can include selected paths when a project needs to process them. See Node and PostCSS integration for the programmatic lifecycle and stylesheet contract.

References: packages/…/index.ts• L1-15 packages/…/builder.ts• L52-220 packages/…/index.ts• L8-96 packages/…/postcss.js• L1-3

Integration choice

Choose the entrypoint that matches the system that already owns the build. The outputs and compiler context remain shared, but the trigger and update signal differ.

If the build is owned by...Use...Result
A package script or developer commandCLIPanda runs as a direct command and can generate or watch project output
A custom JavaScript or TypeScript build stepNode APIThe host process decides when Panda loads, builds, and refreshes
A PostCSS pipelinePostCSS pluginA Panda entry stylesheet causes generated CSS to join the CSS result

This separation keeps application frameworks free to choose their build host while Panda preserves one configuration and output model. Framework-specific adapters are a separate concern from these general entrypoints.

References: packages/…/cli-main.ts• L40-119 packages/…/index.ts• L1-15 packages/…/index.ts• L27-82

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the CLI package exports, binary names, and PostCSS subpath aligned so documented entrypoints resolve to the published surfaces.
  • Keep the Node runtime watch behavior aligned with CLI and PostCSS rebuild expectations. A change in file filtering or path resolution can silently change which style uses reach generated output.
  • Keep PostCSS dependency messages tied to the same configuration and source inputs used by the Node builder. Missing messages can prevent the host pipeline from rebuilding after a Panda input changes.
  • Keep the shared build context contract stable across direct CLI generation and the PostCSS builder. Divergent context refresh rules can produce different output from the same project.

Important failure modes

TriggerConsequenceGuard
The project has no usable Panda configuration or the configured path is wrongThe CLI or integration cannot create the shared build contextResolve the project directory and configuration before starting the build
A PostCSS input does not declare a valid Panda layerThe plugin leaves the stylesheet unchangedFeed the configured Panda entry stylesheet to PostCSS
Source or configuration dependencies are not reported to the host pipelineChanges can leave generated CSS or style-system output stalePreserve dependency messages from the PostCSS integration
A watched file is outside the configured include set or is filtered as an excluded pathIts style usage is not collected and later edits do not trigger the expected rebuildKeep source include and exclude rules aligned with the application files

Key files

FileWhy to read it
packages/…/cli-main.tsShows the user-facing command families and how they load, generate, watch, and inspect Panda projects
packages/…/package.jsonDefines the published CLI entrypoints and the PostCSS package subpath
packages/…/index.tsShows the public programmatic build surface
packages/…/builder.tsExplains the shared build state used by repeated and stylesheet-triggered builds
packages/…/node-runtime.tsShows the file, path, discovery, and watch services used by Node-based execution
packages/…/index.tsDefines how PostCSS invokes Panda and returns generated CSS and dependency information
packages/…/postcss.jsConnects the published CLI package PostCSS entrypoint to the PostCSS plugin