Self-hosted SDKs
Self-hosted SDKs
Self-hosted SDKs
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:
When you self-host, you’re responsible for infrastructure management, SDK distribution, and computing SDK version numbers. 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.
This page assumes that you have:
fern folder. See Set up the fern folder.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:
Verify that a Docker daemon is running on your machine, as SDK generation runs inside a Docker container:
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 your generators.yml to output SDKs to your local file system or a GitHub repository you control.
Output generated SDKs directly to a local directory:
Configure authentication based on your chosen output location.
Set your Fern token as an environment variable:
Cloud generation picks SDK version numbers automatically. With self-hosting, your pipeline computes the next version itself — see Self-hosted SDK versioning for the two supported workflows.
Use the --local flag to generate SDKs locally instead of using Fern’s cloud infrastructure. You can combine --local with --group to generate specific SDKs locally.
By default, fern generate --local pulls generator Docker images from Docker Hub. If your organization mirrors Fern’s images into a private registry, you can configure the CLI to pull from that registry instead.
To use a custom registry, replace the name field in your generator configuration with an image object containing name and registry:
The image.name must be a recognized Fern generator name (for example, fern-python-sdk or fern-typescript-sdk). This ensures the CLI can resolve the correct IR version for your generator. The version must also match a published Fern generator version.
Generators configured with a custom image are skipped during fern generator upgrade. You must manually update the version for these generators.
If your registry requires authentication, log in before running fern generate --local. The CLI uses the credentials stored by Docker.
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:
generators.yml configurationSteps 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.