Skip to content
Purview Dev logo

Documentation section: Configuration

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.

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>
  • 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.

Describing the server: WithServerLikeC4Details

Section titled “Describing the server: WithServerLikeC4Details”

The LikeC4 server is drawn as AspireC4’s own node when WithIncludeAspireC4InternalResource(true) is set. Give it a label, summary, icon, links or metadata with WithServerLikeC4Details:

builder.AddAspireC4()
.WithServerLikeC4Details(options => options.WithLabel("Architecture diagram"));

It works in either order with .WithLocalCLI(): when the CLI resource replaces the container, the details move with it. It is also the form to use from a Go or Python AppHost (see AppHost languages).

Use ConfigureServer for anything else on the inner server resource, such as custom annotations:

builder.AddAspireC4()
.ConfigureServer(server => server.WithAnnotation(new MyAnnotation()));