Overview

Manage and configure your Fern projects, all from the command line.
View as Markdown

The Fern CLI lets you initialize projects, validate API definitions, preview changes locally, and publish documentation and SDKs. This page covers installation and common commands to get you started.

Installation

Run the following command to install the Fern CLI globally from npm:

$npm install -g fern-api
>fern -v

If you prefer to manage Fern as a project dependency or are working in an environment with limited internet connectivity, install the CLI locally:

1

Install as project dependency

$npm install fern-api
2

Update configuration

In your fern.config.json, set the version to * to use your locally installed version:

fern.config.json
1{
2 "organization": "your-org",
3 "version": "*"
4}

See the fern.config.json reference for more details.

3

Run via package manager

$npm fern check
>npm fern generate

CLI workflows by product

The Fern CLI manages both documentation and SDK workflows. Below is a brief overview of the common commands for each. All commands support global options like --log-level for debugging.

For complete CLI documentation, see the command reference.

When working with Fern Docs, you’ll use these CLI commands. For complete instructions, see the Docs quickstart.

CommandDescription
fern init --docsCreate a new docs project
fern docs devPreview docs locally at localhost:3000
fern generate --docsPublish documentation to production

When working with Fern SDKs, you’ll use these CLI commands. For complete instructions, see the SDKs quickstart.

CommandDescription
fern initCreate a new SDK project
fern checkValidate your API definition
fern generate --previewPreview SDKs locally in .preview/
fern generatePublish SDKs to production
fern generate --group <name>Generate a specific SDK group