Local CLI Runtimes
Local CLI Runtimes
Section titled “Local CLI Runtimes”By default the LikeC4 server runs as the ghcr.io/likec4/likec4 Docker container. When Docker is not available — or you prefer a local Node.js-based workflow — switch to a local CLI with .WithLocalCLI().
builder.AddAspireC4().WithLocalCLI();The selected runtime must be installed and accessible on the system PATH.
Runtime selection
Section titled “Runtime selection”builder.AddAspireC4().WithLocalCLI(LocalCLIRuntime.Bun);LocalCLIRuntime supports:
| Runtime | Command |
|---|---|
Auto | Detects the first available runtime in order: npx → pnpm → yarn → bun → deno. |
Npx | npx likec4 serve <dir> --port <port> |
Pnpm | pnpm dlx --ignore-workspace likec4 serve <dir> --port <port> |
Yarn | yarn dlx --package likec4 --package react --package react-dom likec4 serve <dir> --port <port> |
Bun | bunx --bun likec4 serve <dir> --port <port> |
Deno | deno run --allow-all --node-modules-dir=none npm:likec4 serve <dir> --port <port> |
Behavior notes
Section titled “Behavior notes”- The output directory is passed as an absolute path; the server process uses the system temp directory as its working directory so package managers do not walk up and treat the AppHost’s parent
package.jsonas a workspace root. ContainerImageTagis ignored — it only applies to the Docker container.- Yarn’s
dlxdoes not install optional peer dependencies (react,react-dom) by default, so AspireC4 passes them explicitly as--packagearguments. - HMR is enabled with
--hmr-portwhen not disabled;DisableHMRstill applies.
ConfigureServer
Section titled “ConfigureServer”Use ConfigureServer to apply annotations directly to the inner server resource (e.g. WithLikeC4Details):
builder.AddAspireC4() .ConfigureServer(server => server.WithLikeC4Details(options => options.WithLabel("Architecture diagram")));