CLI Overview

The Fern Command Line Interface (Fern CLI) is an open source tool that enables you to interact with the Fern compiler using commands in your command-line shell. Use the Fern CLI to generate code from your API definition.

Fern compiler

Unlike most compilers, the Fern compiler does not produce a single output. Here are some examples of what the Fern compiler can output:

  • A TypeScript Node.js SDK
  • FastAPI server boilerplate
  • A Postman collection
  • An OpenAPI specification

To support the long and growing list of outputs, we’ve built the Fern Compiler to be modular. The core compiler is responsible for parsing and validating your API definition and producing the intermediate representation.

The remaining work is handled by generators. A Fern generator is a program that takes in an intermediate representation and outputs… something. Generators can be written in any language.

Specify which generators you want the compiler to run using the special file generators.yml. For a list of available generators, see Generators.

Generator schema

In this section, we’ll detail the different properties you need to include for a generator.


Each generator has a unique name, e.g., fernapi/fern-typescript-node-sdk.

2 external:
3 generators:
4 - name: fernapi/fern-typescript-node-sdk # <---


You must specify which version of the generator you want to use. This helps ensure consistent builds.

2 external:
3 generators:
4 - name: fernapi/fern-typescript-node-sdk
5 version: 0.7.2 # <---

Default group

You can also specify a default-group in generators.yml:

1default-group: internal-sdks
3 internal-sdks: ...

Then, you can just run fern generate to run the internal-sdks generator(s).


Some generators allow for custom configuration, which you can specify using the optional config key.

1 groups:
2 external:
3 - name: fernapi/fern-openapi
4 version: 0.0.28
5 github:
6 repository: your-org/openapi
7+ config:
8+ format: yaml

Authentication required

Fern’s CLI requires user authentication for code generation:

  • If prompted, proceed with authentication by typing y and pressing enter.
  • Alternatively, initiate the process using fern login. This command will either prompt you to log in or confirm that you’re already authenticated.

Once authenticated:

Permission Verification: Fern checks your credentials to grant access for specific actions, such as publishing your SDK to dedicated registries (e.g.,, syncing code to GitHub, or deploying a documentation site.

  • Proactive Support: Encountered an error? We can promptly intervene and assist with troubleshooting.

  • Enhancing User Experience: Fern collects usage analytics to improve the product.

Feedback: Have thoughts on this login requirement? Join the discussion on this GitHub Issue