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
  • Getting Started
    • Overview
    • Quickstart
    • Customer Showcase
  • Writing Content
    • Markdown
    • Visual Editor
    • Reusable Markdown
    • Custom React Components
      • Previewing changes locally
      • Previewing changes in a PR
      • Publishing your docs
      • Setting up your domain
    • Changelog
LogoLogo
Slack communityLog inBook a demo
On this page
  • Local development
  • Custom ports
  • Generate a preview link
Preview & Publish

Preview changes locally

View and share updates to your documentation
Was this page helpful?
Previous

Pull request previews

Next
Built with

Fern offers two ways to preview changes to your documentation: a local development environment and unique preview links.

Local development

Fern enables you to view changes to your documentation in a locally hosted environment.

Prerequisite: Please install Node.js (version 18 or higher) before proceeding.

Follow these steps to install and run the Fern CLI:

Step 1: Install the Fern CLI:

$npm i -g fern-api

Step 2: Navigate to the docs directory (where the fern folder is located) and execute the following command:

$fern docs dev

A local preview of your documentation will be available at http://localhost:3000. The functionality is available offline if you have run local development mode online at least once.

Some features (e.g. search) are disabled in the local development environment, including:

  • Search
  • SEO (favicon, auto-generated meta tags, etc.)
  • Authentication

Custom ports

By default, Fern uses port 3000. You can customize the port on which Fern runs by using the --port flag. For example, to run Fern on port 3002, use this command:

$fern docs dev --port 3002

If you attempt to run Fern on a port that’s already in use, it will use the next available port:

Generate a preview link

Fern allows you to generate a shareable preview link that displays the current state of your docs. Each preview link is appended with a UUID and is not indexed. Currently, these links do not expire (this behavior is subject to change in the future).

Usage:

$fern generate --docs --preview

Example:

$fern generate --docs --preview
$
$[docs]: Found 0 errors and 1 warnings. Run fern check --warnings to print out the warnings.
$[docs]: Published docs to https://fern-preview-c973a36e-337b-44f5-ab83-aab.docs.buildwithfern.com/learn
$┌─
$│ ✓ docs.example.com
$└─