For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Slack communityLog inBook a demo
  • CLI Reference
    • Get Started with Fern CLI
    • Global Options
    • Commands
    • Changelog
  • API Reference
    • Overview
LogoLogo
Slack communityLog inBook a demo
On this page
  • Installing Fern CLI
  • CLI Quick Start
  • Common Workflows
CLI Reference

Overview

Manage and configure your Fern projects, all from the command line.
Was this page helpful?

Global options

Explore Fern CLI global options.
Next
Built with

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

Setting up Docs
  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
Setting up SDK generation
  1. Initialize a new SDK project:
$fern init
  1. Configure your generators in configuration options

  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.