Self-hosted SDKs
Enterprise feature
This feature is available only for the Enterprise plan. To get started, reach out to support@buildwithfern.com.
Fern SDK generation runs on Fern’s infrastructure by default. Self-hosting allows you to run SDK generation on your own infrastructure. Use self-hosting if your organization:
- Operates without internet access
- Has strict compliance or security requirements
- Needs full control over your SDK generation process
When you self-host, you’re responsible for infrastructure management and SDK distribution. Self-hosted SDK generation includes all Fern SDK features.
Unless you have specific requirements that prevent using Fern’s default hosting, we recommend using our managed cloud generation solution for easier setup and maintenance.
Setup
This page assumes that you have:
- An initialized
fernfolder. See Set up thefernfolder. - SDK generators configured in
generators.yml. See language-specific quickstarts: TypeScript, Python, Go, Java, etc.
Self-hosted SDK generation allows you to output to your local file system or push directly to a GitHub repository you control. Follow these steps to set up and run local generation:
Ensure Docker is running
Verify that a Docker daemon is running on your machine, as SDK generation runs inside a Docker container:
Generate a Fern token
Generate a Fern token, which is required for local generation to verify your organization.
The token is specific to your organization defined in fern.config.json and doesn’t expire.
Configure output location
Configure your generators.yml to output SDKs to your local file system or a GitHub repository you control.
Local file system
GitHub repository
Output generated SDKs directly to a local directory:
How it works
When you run fern generate --local, the Fern CLI executes SDK generation on your local machine instead of using Fern’s cloud infrastructure.
The underlying SDK generation architecture is the same whether you use cloud or self-hosted generation. See the expanded architecture diagram for details.
The self-hosted process works as follows:
- Organization verification (network call) - The CLI verifies your organization registration with Fern
- Download generator image (network call if not cached) - The CLI downloads the generator’s Docker image if not already available locally
- Generate SDK (local) - The CLI runs the generator container locally to produce SDK files based on your API definition and
generators.ymlconfiguration - Output SDK (local) - Generated SDK files are saved to your configured output location (local file system or GitHub repository)
Steps 1 and 2 are the only network calls made when using the --local flag. No API definition or specification data is sent over the network: all SDK generation happens locally on your machine.