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

Install the Fern CLI with npm or Homebrew.

Requires Node.js 22 or higher, which ships with npm 10 or higher. If you’re on an older version, upgrade Node.js.

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

Alternative: install as a project dependency

Most users install Fern globally with the commands above. Install it locally instead to pin its version per project or to work in an environment with limited internet connectivity. Local installs use npm. Homebrew supports only system-wide installs.

1

Add Fern to your project

$npm install fern-api
2

Set the version to your local install

In fern.config.json, set the version to *:

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

The fern.config.json reference covers the remaining fields.

3

Run commands through npm

$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