Self-hosted generation
Self-hosted generation
Early access
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 organization verification and pulling the Docker image (if not cached). 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_TOKENfor organization verification (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
Self-hosted generation still requires a network call to verify your organization. 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: