< We're launched Liam ERD!

Learn More

Liam ERD CLI

Quick Start

The fastest way to get started with Liam ERD is using the interactive setup command:

npx @liam-hq/cli init
pnpm dlx @liam-hq/cli init
yarn dlx @liam-hq/cli init
bun x @liam-hq/cli init

Manual Setup

For more control over the ERD generation process, you can use the erd command directly:

Basic Usage

Generate an ERD from your schema file using the following command:

npx @liam-hq/cli erd build --input <path|url>
pnpm dlx @liam-hq/cli erd build --input <path|url>
yarn dlx @liam-hq/cli erd build --input <path|url>
bun x @liam-hq/cli erd build --input <path|url>

This command processes your schema file and generates interactive ERD visualization files in the dist directory. The schema format is automatically detected (see Format Auto-Detection), but you can override it using the --format option if needed. Also, output directory can be specified by --output-dir option.

Once the ERD is generated, you can view it by serving the files using a local HTTP server:

npx http-server dist  # or your custom output directory
pnpm dlx http-server dist  # or your custom output directory
yarn dlx http-server dist  # or your custom output directory
bun x http-server dist  # or your custom output directory

The server will start and provide you with a local URL (typically http://localhost:8080) where you can view your ERD in a web browser.

You can use any hosting service of your choice to serve the generated files.

Options

  • --input <path|url>: Path to your schema file or URL
  • --format <format>: (Optional) Override the auto-detected schema format
  • --output-dir <path>: (Optional) Specify the output directory for generated files (default: "dist")

From GitHub Public Repository

You can directly specify URLs to schema files stored in public GitHub repositories. Using raw URLs allows you to generate ERDs directly from remote schema files.

npx @liam-hq/cli erd build --input https://github.com/user/repo/blob/main/examples/schema.sql --format postgres
pnpm dlx @liam-hq/cli erd build --input https://github.com/user/repo/blob/main/examples/schema.sql --format postgres
yarn dlx @liam-hq/cli erd build --input https://github.com/user/repo/blob/main/examples/schema.sql --format postgres
bun x @liam-hq/cli erd build --input https://github.com/user/repo/blob/main/examples/schema.sql --format postgres
npx @liam-hq/cli erd build --input https://raw.githubusercontent.com/user/repo/main/examples/schema.sql --format postgres
pnpm dlx @liam-hq/cli erd build --input https://raw.githubusercontent.com/user/repo/main/examples/schema.sql --format postgres
yarn dlx @liam-hq/cli erd build --input https://raw.githubusercontent.com/user/repo/main/examples/schema.sql --format postgres
bun x @liam-hq/cli erd build --input https://raw.githubusercontent.com/user/repo/main/examples/schema.sql --format postgres

Output

The command generates a simple web application using Vite, which includes JavaScript, CSS, and HTML files, in the dist directory of your current working directory (or the directory specified by --output-dir option).

To view the generated ERD, serve the output directory using any HTTP server:

npx http-server dist  # or your custom output directory
pnpm dlx http-server dist  # or your custom output directory
yarn dlx http-server dist  # or your custom output directory
bun x http-server dist  # or your custom output directory

Sample Projects

For sample projects and setup examples, check out our liam-erd-samples repository.