Project structure

View as Markdown

This page provides an overview of the file and folder structure of a Fern Docs project.

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.yaml# 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.

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

Example fern/docs.yml
1instances:
2 - url: plantstore.docs.buildwithfern.com
3
4title: Fern Docs Starter
5
6tabs:
7 home:
8 display-name: Docs
9 icon: home
10 API Reference:
11 display-name: API Reference
12 icon: puzzle
13
14navigation:
15 - tab: home
16 layout:
17 - section: Get started
18 contents:
19 - page: Welcome
20 path: docs/pages/welcome.mdx
21 - page: Edit your docs
22 path: docs/pages/editing-your-docs.mdx
23 - section: Changelog
24 contents:
25 - changelog: docs/changelog
26 - tab: API Reference
27 layout:
28 - api: Plant Store API
29
30navbar-links:
31 - type: minimal
32 text: Fork this repo
33 url: https://github.com/fern-api/docs-starter
34 - type: filled
35 text: Dashboard
36 url: https://dashboard.buildwithfern.com
37
38logo:
39 light: docs/assets/logo.svg
40 dark: docs/assets/logo-dark.svg
41
42colors:
43 accent-primary:
44 dark: "#70E155"
45 light: "#008700"
46
47favicon: docs/assets/favicon.svg
48
49css: styles.css

API definitions and generators.yml

To generate API Reference documentation, you need to provide your API definition. How you do this depends on your format:

  • OpenAPI/AsyncAPI: Always requires a generators.yml file with an api.specs section. You can optionally add a groups section for SDK generation.
  • Fern Definition: Auto-detected when you have a definition/ directory. Only add generators.yml if you’re generating SDKs.
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
1api:
2 specs:
3 - openapi: openapi.yaml

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
1api:
2 specs:
3 - openapi: openapi.yaml
4 - asyncapi: asyncapi.yaml

You can optionally add an overrides file for additional customizations.

The definition folder contains the Fern Definition YAML files used to generate the API Reference section. Fern automatically detects this directory, so no generators.yml is needed for API Reference documentation.

You can optionally add an overrides file for additional customizations.

definition
pets.yaml
owners.yaml
stores.yaml
overrides.yaml# Optional
api.yaml

See an example.

Organize multiple APIs into separate folders. You can mix OpenAPI and Fern Definition formats:

apis
admin-api
openapi.json
generators.yml# Required for OpenAPI
overrides.yaml# Optional
user-api
definition# Auto-detected for Fern Definition
api.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.

fern.config.json
1{
2 "organization": "plantstore",
3 "version": "4.46.3"
4}

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