Skip to navigation

Project structure

View as Markdown

This page provides an overview of the file and folder structure of a Fern Docs project. If you’re spreading docs across multiple repositories that publish to the same domain, see Multi-source docs.

Directory structure

The configuration files for your docs live in the fern folder:

fern
docs# Documentation content
pages# MDX files
assets# Images, logos, favicon
changelog# Changelog entries
snippets# Reusable MDX snippets
docs.yml# Defines navigation, theme, and hosting
openapi.yml# API definition (OpenAPI, AsyncAPI, etc.)
generators.yml# References specs, configures SDKs
fern.config.json# Organization name and CLI version
styles.css# Custom CSS styles

The fern and changelog folders are reserved names — Fern won’t recognize them if renamed. All other folder names are customizable.

Pages folder

The pages folder contains the Markdown (MDX) files that make up your documentation. Each MDX file represents a page in your documentation. The folder name is customizable.

pages
welcome.mdx
navigation.mdx
customization.mdx
support.mdx

You can organize the pages folder into subfolders based on the sections of your documentation, or keep pages flat as shown above.

Assets folder

The assets folder contains any images or videos used in your documentation. You can reference these assets in your MDX files using relative paths. The folder name is customizable.

assets
favicon.svg
logo.svg# Light mode logo
logo-dark.svg# Dark mode logo

docs.yml

The docs.yml file is the heart of your Fern documentation site. This configuration file controls your documentation’s navigation structure, visual design, site functionality, and hosting settings. Only files referenced in your docs.yml navigation (or discovered via a folder configuration) are included in builds — any unreferenced files are ignored.

Fern treats .yml and .yaml extensions identically. This applies to all YAML files in a Fern project, including docs.yml, generators.yml, and API specification files.

For complete configuration options, see the docs.yml reference.

Example fern/docs.yml
instances:
- url: plantstore.docs.buildwithfern.com
title: Fern Docs Starter
tabs:
home:
display-name: Docs
icon: home
API Reference:
display-name: API Reference
icon: puzzle
navigation:
- tab: home
layout:
- section: Get started
contents:
- page: Welcome
path: docs/pages/welcome.mdx
- page: Edit your docs
path: docs/pages/editing-your-docs.mdx
- section: Changelog
contents:
- changelog: docs/changelog
- tab: API Reference
layout:
- api: Plant Store API
navbar-links:
- type: minimal
text: Fork this repo
url: https://github.com/fern-api/docs-starter
- type: filled
text: Dashboard
url: https://dashboard.buildwithfern.com
logo:
light: docs/assets/logo.svg
dark: docs/assets/logo-dark.svg
colors:
accent-primary:
dark: "#70E155"
light: "#008700"
favicon: docs/assets/favicon.svg
css: styles.css

API definitions and generators.yml

To generate API Reference documentation, you need to provide your API definition. OpenAPI and AsyncAPI specs require a generators.yml file with an api.specs section. You can optionally add a groups section for SDK generation.

Using Fern for both API Reference docs and SDKs? You’ll use docs.yml for your documentation settings and generators.yml to configure SDK code snippets in your API Reference.

Place your OpenAPI specification file in the fern/ directory (or in a subfolder). Fern supports either YAML or JSON format.

Reference it in generators.yml:

generators.yml
api:
specs:
- openapi: openapi.yml

You can optionally add an overlays file for additional customizations. To see this in practice, check out Fluidstack’s Fern configuration.

Place your AsyncAPI specification file in the fern/ directory alongside your OpenAPI spec. Reference it in generators.yml:

generators.yml
api:
specs:
- openapi: openapi.yml
- asyncapi: asyncapi.yaml

You can optionally add an overrides file for additional customizations.

Organize multiple APIs into separate folders:

apis
admin-api
openapi.json
generators.yml
overrides.yaml# Optional
user-api
openapi.yml
generators.yml
overrides.yaml# Optional

The apis folder must use this exact name. Reference each API in docs.yml using api-name that matches the subfolder name. To see this in practice, check out Vapi’s Fern configuration.

fern.config.json

The fern.config.json file stores your organization name and the Fern CLI version. Pinning the version provides deterministic builds. To keep every project in your organization on a compatible version, set an organization-wide CLI version policy.

fern.config.json
{
"organization": "plantstore",
"version": "5.23.3"
}

When working with a locally installed CLI, set version to "*". See Install Fern CLI locally for details.