Skip to main content

Getting started

Welcome to Fern! This guide walks through setting up Fern in your repo, defining your API, and generating code.

Setting up Fern in your repo


In terminal, run npm install -g fern-api.


In the root of your repo, run fern init. This will create the following folder structure in your project:

├─ fern.config.json # root-level configuration
└─ api/ # your API
├─ generators.yml # generators you're using
└─ definition/
├─ api.yml # configuration for your API
└─ imdb.yml # a Service, which includes some endpoints

Defining your API

Your Fern Definition is a set of YAML files that are the single source of truth for your API. You check your Fern Definition into your repo, inside of which describes your API requests, responses, model, paths, methods, errors, and authentication scheme.

Check out an example Fern Definition on Github.

Already have OpenAPI spec?

Join our private beta for access to our OpenAPI spec -> Fern Definition converter.

Generate code

Fern's code generators run remotely in the cloud. The input is your Fern Definition and the output is auto-generated code. You configure which generators you're using in generators.yml.

Check out an example generators.yml on Github.

What's next?