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
  • Usage
  • Example
  • Usage in GitHub Actions
  • Hosting
  • Self-hosting your docs
Preview & Publish

Publishing your docs

Was this page helpful?
Previous

Bring your custom domain

Next
Built with

When you are ready for your docs to be publicly accessible, you can publish them using the Fern CLI.

Usage

$fern generate --docs

Example

$fern generate --docs
$[docs]: Found 0 errors and 1 warnings. Run fern check --warnings to print out the warnings.
$[docs]: ✓ All checks passed
$[docs]: Published docs to https://plantstore.docs.buildwithfern.com
$┌─
$│ ✓ https://plantstore.docs.buildwithfern.com
$└─

Usage in GitHub Actions

To automate the publishing process, you can use a GitHub Action workflow to publish your docs when a push is made to the main branch. Be sure to add the FERN_TOKEN for your organization to the repository.

.github/workflows/publish-docs.yml
1name: Publish Docs
2
3on:
4 push:
5 branches:
6 - main
7
8jobs:
9 run:
10 runs-on: ubuntu-latest
11 if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/heads/main') && github.run_number > 1 }}
12 steps:
13 - name: Checkout repository
14 uses: actions/checkout@v4
15
16 - name: Install Fern
17 run: npm install -g fern-api
18
19 - name: Publish Docs
20 env:
21 FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
22 run: fern generate --docs

Hosting

When you publish your docs, Fern takes care of hosting them for you. To publish your docs to a custom domain, check out our docs here.

Self-hosting your docs

This feature is available on the Enterprise plan. Contact us to learn more.

If you need access to your docs offline or would like to host your docs on your own server, Fern offers that option as well. Self-hosted docs have limited access to certain features (including search).