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

Installing Fern CLI

Run the following command to download and install Fern CLI from the npm registry.

$npm install -g fern-api # install Fern CLI
>fern -v # ensure Fern was successfully installed

CLI Quick Start

Get started with these commonly used commands:

Common Commands
$# Docs Development
>fern init --docs # Create a new documentation project
>fern docs dev # Preview docs locally at localhost:3000
>fern generate --docs --preview # Preview documentation changes
>fern generate --docs # Generate and publish documentation
>
># SDK Development
>fern init # Start new SDK project
>fern check # Validate API definition
>fern generate --preview # Preview SDKs in .preview/ folder
>fern generate # Generate default SDK group
>fern generate --group ts-sdk # Generate specific SDK group

The “default SDK group” refers to the group marked as default in your generators.yml. Learn more about default groups.

Common Workflows

  1. Initialize a new docs project:
$fern init --docs
  1. Preview locally while making changes:
$fern docs dev
  1. When ready to preview or publish:
$fern generate --docs --preview # Generate a shareable preview link
>fern generate --docs # Publish to production
  1. Initialize a new SDK project:
$fern init
  1. Configure your generators in generators.yml

  2. Generate SDKs:

$fern generate --preview # Preview changes locally
>fern generate --group python-sdk --preview # Preview specific SDK group
>fern generate # Publish to production

During development, use --preview to test your changes locally before publishing. The preview SDK will be generated into the .preview/ folder.

Built with