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.
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. You can view the list of available generators here.
In this section, we'll detail the different properties you need to include for a generator.
Each generator has a unique name, e.g.,
You must specify which version of the generator you want to use. This helps ensure consistent builds.
You can also specify a
Then, you can just run
fern generate to run the
Some generators allow for custom configuration, which you can specify using the optional
Fern's CLI requires user authentication for code generation:
- If prompted, proceed with authentication by typing
yand 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.
Permission Verification: Fern checks your credentials to grant access for specific actions, such as publishing your SDK to dedicated registries (e.g., npm.buildwithfern.com), 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 requirements? Join the discussion on this GitHub Issue