Skip to content

Local CLI Runtimes

Stable AspireC4 Reviewed 2026-09-16 purview-dev/aspirec4 architecture architecture-as-code architecture-diagrams aspire aspire-dashboard aspire-dotnet aspire-hosting aspnetcore c4 c4-model developer-experience devex diagram diagrams dotnet likec4 roslyn source-generator visualization

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.

builder.AddAspireC4().WithLocalCLI(LocalCLIRuntime.Bun);

LocalCLIRuntime supports:

RuntimeCommand
AutoDetects the first available runtime in order: npx → pnpm → yarn → bun → deno.
Npxnpx likec4 serve <dir> --port <port>
Pnpmpnpm dlx --ignore-workspace likec4 serve <dir> --port <port>
Yarnyarn dlx --package likec4 --package react --package react-dom likec4 serve <dir> --port <port>
Bunbunx --bun likec4 serve <dir> --port <port>
Denodeno run --allow-all --node-modules-dir=none npm:likec4 serve <dir> --port <port>
  • 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.json as a workspace root.
  • ContainerImageTag is ignored — it only applies to the Docker container.
  • Yarn’s dlx does not install optional peer dependencies (react, react-dom) by default, so AspireC4 passes them explicitly as --package arguments.
  • HMR is enabled with --hmr-port when not disabled; DisableHMR still applies.

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")));