Self-hosted generation
The CLI generator is in early access. Reach out to get started.
By default, fern generate runs the CLI generator on Fern’s cloud infrastructure. Pass --local to run generation on your own machine instead. No API definition data leaves your machine: the only network calls are pulling the Docker image (if not cached) and, when a Fern token is available, organization verification. This suits organizations with strict security or compliance requirements that need to keep their spec off Fern’s infrastructure.
Comparison with cloud generation
Prerequisites
- Fern CLI v5.37.9 or later (
npm install -g fern-api) - Docker running on your machine
- Rust toolchain (stable) for building the generated output
- A
FERN_TOKENif you output to a GitHub repository (optional for local file system output; generate one withfern tokenor from the Dashboard)
Setup
This page assumes you’ve completed the Quickstart, so your generators.yml already writes to a local-file-system output path. Adding --local runs that same configuration through Docker instead of Fern’s cloud.
Set your Fern token (optional)
Local file system output doesn’t require a token. When a token is set, the CLI verifies your organization and applies its settings, such as white-labeling, to the generated output. Generate a token with fern token or from the Fern Dashboard, then export it:
Run local generation
The CLI pulls the generator’s Docker image (cached after the first run), processes your OpenAPI spec, and writes a complete Rust project to the configured output path. Images pull from Docker Hub by default; you can alternatively pull from a private registry.
Custom container registry
By default, --local pulls generator images from Docker Hub. To pull from a private registry, replace the name field with an image object:
If your registry requires authentication, log in before running generation: