Quickstart
Configuring Fern starts with the fern
folder, the root directory that contains
your API definitions, generators, and your CLI version.
Set up the fern folder
Install the Fern CLI
Run the following command to install the CLI tool or update it to the latest version:
Initialize the Fern Folder
You can initialize your fern folder with either a Fern Definition or OpenAPI specification.
You can always convert a Fern Definition to OpenAPI or OpenAPI to a Fern Definition later on.
Option 1: OpenAPI
Initialize the fern folder using your OpenAPI Specification. Fern can
handle both JSON and YML formats for OpenAPI specifications and the
--openapi
flag accepts either format, so you can use whichever format your
API spec is available in.
Run one of the following commands based on your spec’s location:test
--organization <YourOrganization>
configures your organization name in
fern.config.json
. This is required in order to successfully generate your
SDK.
This creates a fern
folder in your current directory with the OpenAPI Specification. The exact folder structure might look different depending on your initial input files.
Option 2: Fern Definition
-
Initialize the fern folder using the Fern Definition by running the following command:
--organization <YourOrganization>
configures your organization name infern.config.json
. This is required in order to successfully generate your SDK.This creates a
fern
folder in your current directory with the Fern Definition.imdb.yml
contains an example movies API. If you’re just generating an SDK for test purposes, you can leave this file as it is. To generate an SDK for your own API instead of the example movies API, replaceimdb.yml
with your own endpoints, types, and errors before proceeding with the rest of this page.
Next: Set up your repository structure
Now that you have your fern
folder initialized, learn how to organize your repositories for SDK generation.