# LikeC4 CLI

import { PackageManagers } from 'starlight-package-managers';

<p style={{display: 'flex', gap: '10px'}}>
<a href="https://www.npmjs.com/package/likec4" target="_blank">![NPM Version](https://img.shields.io/npm/v/likec4)</a>
<a href="https://www.npmjs.com/package/likec4" target="_blank">![NPM Downloads](https://img.shields.io/npm/dm/likec4)</a>
</p>

The `likec4` CLI is a tool for various operations and automation, such as:

- Start development server to preview diagrams (with hot-reload)
- Build a static website for sharing and embedding diagrams
- Export to PNG, Mermaid, Dot, D2
- Generate [source code artifacts](/tooling/code-generation/react/):
  - React components
  - Web Components
  - Typed data

## Install

### Local installation

If you're using it in an npm project, install it as a development dependency:

<PackageManagers
    pkg="likec4"
    dev
    pkgManagers={['npm', 'pnpm', 'yarn', 'bun']}
    frame="none"
  />

You can reference it directly in the `package.json#scripts` object:

```json5
{
  scripts: {
    dev: 'likec4 dev ...',
    build: 'likec4 build ...'
  }
}
```

### Global installation

To fetch and execute a package binary, without installing it as a dependency:

<PackageManagers
   type="dlx"
   pkg="likec4"
   args="start"
   pkgManagers={['npm', 'pnpm', 'yarn', 'bun']}
   frame="none"
   />


If you want to use it in any arbitrary project without [`npx`](https://docs.npmjs.com/cli/v10/commands/npx), install it globally:

```sh
npm install --global likec4