CLI

fern init

fern init initializes a new Fern workspace in the current folder. By default, you’ll see the IMDb API (International Movie Database) example.

Usage

$fern init [--docs]

This will create the following folder structure in your project:

1fern/
2├─ fern.config.json # root-level configuration
3├─ generators.yml # generators you're using
4└─ definition/
5 ├─ api.yml # API-level configuration
6 └─ imdb.yml # endpoints, types, and errors

Options

By adding --docs, you’ll also get a sample documentation website for your API with an API Reference section.

$$ fern init --docs

The file added will look like:

docs.yml
1instances:
2 - url: https://your-organization.docs.buildwithfern.com
3title: Your Organization | Documentation
4navigation:
5 - api: API Reference
6colors:
7 accentPrimary: '#ffffff'
8 background: '#000000'

To publish the API docs, run fern generate --docs. See more details on this command at fern-generate.