Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions fern/products/api-def/pages/project-structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,9 @@ fern/
Beyond the core files, you can optionally use an overrides file to customize your API definition without modifying the original spec. See [Overrides](/api-definitions/overview/overrides) for instructions.
</Note>

### `fern.config.json file`
### `fern.config.json`

Every fern folder has a single `fern.config.json` file. This file stores the organization and
the version of the Fern CLI that you are using.

```json title="fern.config.json"
{
"organization": "your-organization",
"version": "0.31.2"
}
```

Every time you run a fern CLI command, the CLI downloads itself at the correct version to ensure
determinism.
<Markdown src="/snippets/fern-config-json-reference.mdx" />

### `generators.yml`

Expand Down Expand Up @@ -196,4 +185,4 @@ groups:
```

</Accordion>
</AccordionGroup>
</AccordionGroup>
2 changes: 2 additions & 0 deletions fern/products/cli-api-reference/pages/cli-get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ In your `fern.config.json`, set the version to `*` to use your locally installed
}
```

See the [fern.config.json reference](/learn/sdks/overview/project-structure#fernconfigjson) for more details.

</Step>

<Step title="Run via package manager">
Expand Down
8 changes: 4 additions & 4 deletions fern/products/cli-api-reference/pages/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ hideOnThisPage: true

<Accordion title="fern check">

Use `fern check` to validate your API definition and Fern configuration: `fern.config.json`, `generators.yml`, and `docs.yml`.
Use `fern check` to validate your API definition and Fern configuration: [`fern.config.json`](/learn/sdks/overview/project-structure#fernconfigjson), `generators.yml`, and `docs.yml`.

When successfully executed, this command will not produce any output.

Expand Down Expand Up @@ -336,7 +336,7 @@ hideOnThisPage: true

<Accordion title="fern upgrade">

Use `fern upgrade` to upgrade your compiler version in `fern.config.json` to the
Use `fern upgrade` to upgrade your compiler version in [`fern.config.json`](/learn/sdks/overview/project-structure#fernconfigjson) to the
latest version. It will also upgrade generators in `generators.yml` to their minimum-compatible versions.

<CodeBlock title="terminal">
Expand Down Expand Up @@ -389,8 +389,8 @@ hideOnThisPage: true

<Accordion title="fern token">

Use `fern token `to generate a `FERN_TOKEN` specific to your organization defined
in `fern.config.json`. Use the token to authenticate with the API in CI. Tokens do not expire.
Use `fern token` to generate a `FERN_TOKEN` specific to your organization defined
in [`fern.config.json`](/learn/sdks/overview/project-structure#fernconfigjson). Use the token to authenticate with the API in CI. Tokens do not expire.

<CodeBlock title="terminal">
```bash
Expand Down
11 changes: 1 addition & 10 deletions fern/products/docs/pages/getting-started/project-structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,6 @@ title: Fern's Documentation

## `fern.config.json`

The `fern.config.json` file specifies your organization name and the version of the Fern CLI used to generate the documentation. You can customize this file to reflect your organization's details.

<CodeBlock title="fern/fern.config.json">
```json
{
"organization": "my-organization",
"version": "<Markdown src="/snippets/version-number-cli.mdx"/>"
}
```
</CodeBlock>
<Markdown src="/snippets/fern-config-json-reference.mdx" />


6 changes: 4 additions & 2 deletions fern/products/docs/pages/getting-started/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ In this guide, we'll show you how to get started with Fern in under 5 minutes.
Next, please update the template settings to use your organization.

<Warning title="Edit template settings">
Please edit the details `fern.config.json` and `docs.yml` with your organization
Please edit the details in `fern.config.json` and `docs.yml` with your organization
name.

<CodeBlocks>
<CodeBlock title="fern.config.json">
```json {2}
{
"organization": "{{YOUR_ORGANIZATION}}",
"version": "0.x.x"
"version": "<Markdown src="/snippets/version-number-cli.mdx"/>"
}
```
</CodeBlock>
Expand All @@ -48,6 +48,8 @@ In this guide, we'll show you how to get started with Fern in under 5 minutes.
```
</CodeBlock>
</CodeBlocks>

See the [fern.config.json reference](/learn/sdks/overview/project-structure#fernconfigjson) for more details.
</Warning>
Finally, navigate to the docs directory (where the `fern` folder is located) and execute the following command to generate your documentation:

Expand Down
13 changes: 2 additions & 11 deletions fern/products/sdks/project-structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,7 @@ The source repository contains a `fern/` folder that is initialized with your A

### `fern.config.json`

Every fern folder has a single `fern.config.json` file. This file stores the organization name and the version of the Fern CLI that you are using:

```json
{
"organization": "your-organization",
"version": "<Markdown src="/snippets/version-number-cli.mdx"/>"
}
```

Every time you run a fern CLI command, the CLI downloads itself at the correct version to ensure determinism.
<Markdown src="/snippets/fern-config-json-reference.mdx" />

### `generators.yml`

Expand All @@ -72,4 +63,4 @@ See [Project structure (API Definitions)](/api-definitions/overview/project-stru

1. **Create repositories**: Set up your source repository, plus one repository for each SDK
2. **Install Fern GitHub App**: Install the [Fern GitHub App](https://github.com/apps/fern-api) on all repositories
3. **Configure `generators.yml`**: In your `generators.yml`, add a reference to each SDK repository.
3. **Configure `generators.yml`**: In your `generators.yml`, add a reference to each SDK repository.
57 changes: 57 additions & 0 deletions fern/snippets/fern-config-json-reference.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## fern.config.json reference
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[FernStyles.Headings] 'fern.config.json reference' should use sentence-style capitalization.


Every `fern/` folder contains a single `fern.config.json` file at its root. This configuration file stores your organization name and the Fern CLI version used for your project.

### Schema

The `fern.config.json` file has two required fields:

- **`organization`** (string): Your organization identifier. This is used by `fern token` to generate organization-specific authentication tokens and to scope CLI actions to your organization. You can view and manage your organization in the [Fern Dashboard](https://dashboard.buildwithfern.com/).

- **`version`** (string): The Fern CLI version to use. Accepts a pinned semantic version (e.g., `"0.94.1"`) or `"*"` to use your locally installed CLI version.

### Examples

<Tabs>
<Tab title="Pinned version (recommended for CI)">

```json title="fern.config.json"
{
"organization": "plant-catalog",
"version": "<Markdown src="/snippets/version-number-cli.mdx"/>"
}
```

Pinning to a specific version ensures deterministic builds. Every time you run a Fern CLI command, the CLI downloads itself at the specified version.

</Tab>
<Tab title="Local development">

```json title="fern.config.json"
{
"organization": "plant-catalog",
"version": "*"
}
```

Using `"*"` tells Fern to use your locally installed CLI version. This is useful for local development when you've installed Fern as a project dependency. See [Install Fern CLI locally](/learn/cli-api/cli-reference/overview#install-fern-cli-locally) for details.

</Tab>
</Tabs>

### When to change these values

- **`organization`**: Only update this if your organization identifier changes in the Fern Dashboard.

- **`version`**: Use the `fern upgrade` command to update the CLI version. The command automatically updates this field in `fern.config.json` and upgrades generators in `generators.yml` to their minimum-compatible versions.

### How the CLI uses this file

The following CLI commands read from `fern.config.json`:

- **`fern check`**: Validates the configuration file
- **`fern upgrade`**: Updates the `version` field to the current CLI version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [vale] reported by reviewdog 🐶
[FernStyles.Current] Avoid time-relative terms like 'current' that become outdated

- **`fern token`**: Uses the `organization` field to generate organization-specific tokens
- **`fern init`**: Creates this file when initializing a project

The version pinning ensures determinism across different environments. When you run any Fern CLI command, it automatically downloads and uses the specified CLI version, ensuring consistent behavior in local development, CI/CD pipelines, and across team members.
Loading