Get inspired by API documentation built with Fern: Webflow | You.com | Cohere | ElevenLabs
- Node.js 22+ (required for
npm install) or Homebrew (macOS/Linux) - A GitHub account
- A Fern account (free to start)
Install the Fern CLI globally using one of the following methods:
npm (all platforms):
npm install -g fern-apiHomebrew (macOS / Linux):
brew install fern-apiVerify the installation:
fern --versionfern/
βββ docs.yml # Site config: navigation, theme, tabs, navbar links
βββ fern.config.json # Organization name and CLI version
βββ generators.yml # API spec sources (OpenAPI, AsyncAPI)
βββ openapi.yaml # Sample Plant Store OpenAPI spec
βββ asyncapi.yaml # Sample AsyncAPI spec
βββ styles.css # Custom CSS overrides
βββ snippets/ # Reusable MDX content fragments
βββ docs/
β βββ pages/ # Markdown (MDX) documentation pages
β βββ assets/ # Logos, favicon, and static assets
β βββ changelog/ # Changelog entries
βββ ...
.github/
βββ workflows/
βββ check.yml # Validates your API spec on every PR and push
βββ preview-docs.yml # Generates a preview URL on every PR
βββ publish-docs.yml # Publishes docs to production on merge to main
This repository is the official starter template for Fern Docs β the same one used in the Fern Docs quickstart. The steps below get you publishing; the quickstart walks through the same flow with more narration and screenshots.
Prefer a no-code setup? Use the guided UI to get started from your browser instead.
-
Create your repository. Click "Use this template" on GitHub and clone the result, or use the GitHub CLI. To start from an empty project instead, run
fern init --docs.gh repo create my-org/my-docs --template fern-api/docs-starter --clone
-
Configure your organization. Set your organization name in
fern/fern.config.jsonand your docs URL infern/docs.yml:# fern/fern.config.json { "organization": "your-org-name", "version": "*" }
# fern/docs.yml instances: - url: your-org-name.docs.buildwithfern.com
-
Validate your configuration.
fern check
-
Preview locally with hot-reloading at localhost:3000.
fern docs dev
-
Publish to go live, or add
--previewfor a shareable preview URL. Runfern loginonce first to authenticate; the credential is cached for future runs.fern login fern generate --docs
This template includes three GitHub Actions workflows out of the box:
| Workflow | Trigger | What it does |
|---|---|---|
check.yml |
Every PR and push to main |
Runs fern check to validate your API spec |
preview-docs.yml |
Every PR | Generates a preview URL and posts it as a PR comment |
publish-docs.yml |
Push to main (after first build) |
Publishes your docs to production |
CI/CD runs non-interactively, so it needs a Fern API key (FERN_TOKEN) instead of fern login. Generate a non-expiring key with fern token (or from the Fern dashboard under API keys), then add it as a repository secret:
- Go to Settings > Secrets and variables > Actions in your GitHub repository.
- Click New repository secret.
- Name it
FERN_TOKENand paste your value.
The check.yml workflow works without an API key; only preview and publish require it.
Once you're up and running, tailor your docs to match your brand and product:
- Brand your docs β Set custom colors, logo, favicon, and fonts in
docs.yml - Add an API reference β Auto-generate interactive API docs from your OpenAPI spec
- Use components β Tabs, accordions, callouts, cards, and more out of the box
- Set up a custom domain β Host on your own domain (e.g.,
docs.example.com) - Configure analytics β Integrate with PostHog, Segment, Google Tag Manager, and others
- Customize navigation β Add versioned docs, tabs, nested sections, and multi-product layouts
Need help? Set up a call with an expert or email us at support@buildwithfern.com.