Skip to content

Commit 35736d6

Browse files
Improve fern.config.json documentation
- Create comprehensive snippet for fern.config.json reference - Update all project structure pages to reference the snippet - Fix hard-coded CLI version in API definitions page - Add cross-references in CLI commands page - Use plant-themed examples per documentation guidelines Co-Authored-By: Devin Logan <[email protected]>
1 parent c94b89e commit 35736d6

File tree

7 files changed

+73
-41
lines changed

7 files changed

+73
-41
lines changed

fern/products/api-def/pages/project-structure.mdx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,9 @@ fern/
2626
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.
2727
</Note>
2828

29-
### `fern.config.json file`
29+
### `fern.config.json`
3030

31-
Every fern folder has a single `fern.config.json` file. This file stores the organization and
32-
the version of the Fern CLI that you are using.
33-
34-
```json title="fern.config.json"
35-
{
36-
"organization": "your-organization",
37-
"version": "0.31.2"
38-
}
39-
```
40-
41-
Every time you run a fern CLI command, the CLI downloads itself at the correct version to ensure
42-
determinism.
31+
<Markdown src="/snippets/fern-config-json-reference.mdx" />
4332

4433
### `generators.yml`
4534

@@ -196,4 +185,4 @@ groups:
196185
```
197186

198187
</Accordion>
199-
</AccordionGroup>
188+
</AccordionGroup>

fern/products/cli-api-reference/pages/cli-get-started.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ In your `fern.config.json`, set the version to `*` to use your locally installed
3939
}
4040
```
4141

42+
See the [fern.config.json reference](/learn/sdks/overview/project-structure#fernconfigjson) for more details.
43+
4244
</Step>
4345

4446
<Step title="Run via package manager">

fern/products/cli-api-reference/pages/commands.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ hideOnThisPage: true
221221

222222
<Accordion title="fern check">
223223

224-
Use `fern check` to validate your API definition and Fern configuration: `fern.config.json`, `generators.yml`, and `docs.yml`.
224+
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`.
225225

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

@@ -336,7 +336,7 @@ hideOnThisPage: true
336336

337337
<Accordion title="fern upgrade">
338338

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

342342
<CodeBlock title="terminal">
@@ -389,8 +389,8 @@ hideOnThisPage: true
389389

390390
<Accordion title="fern token">
391391

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

395395
<CodeBlock title="terminal">
396396
```bash

fern/products/docs/pages/getting-started/project-structure.mdx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,6 @@ title: Fern's Documentation
180180

181181
## `fern.config.json`
182182

183-
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.
184-
185-
<CodeBlock title="fern/fern.config.json">
186-
```json
187-
{
188-
"organization": "my-organization",
189-
"version": "<Markdown src="/snippets/version-number-cli.mdx"/>"
190-
}
191-
```
192-
</CodeBlock>
183+
<Markdown src="/snippets/fern-config-json-reference.mdx" />
193184

194185

fern/products/docs/pages/getting-started/quickstart.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ In this guide, we'll show you how to get started with Fern in under 5 minutes.
2929
Next, please update the template settings to use your organization.
3030

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

3535
<CodeBlocks>
3636
<CodeBlock title="fern.config.json">
3737
```json {2}
3838
{
3939
"organization": "{{YOUR_ORGANIZATION}}",
40-
"version": "0.x.x"
40+
"version": "<Markdown src="/snippets/version-number-cli.mdx"/>"
4141
}
4242
```
4343
</CodeBlock>
@@ -48,6 +48,8 @@ In this guide, we'll show you how to get started with Fern in under 5 minutes.
4848
```
4949
</CodeBlock>
5050
</CodeBlocks>
51+
52+
See the [fern.config.json reference](/learn/sdks/overview/project-structure#fernconfigjson) for more details.
5153
</Warning>
5254
Finally, navigate to the docs directory (where the `fern` folder is located) and execute the following command to generate your documentation:
5355

fern/products/sdks/project-structure.mdx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,7 @@ The source repository contains a `fern/` folder that is initialized with your A
4343

4444
### `fern.config.json`
4545

46-
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:
47-
48-
```json
49-
{
50-
"organization": "your-organization",
51-
"version": "<Markdown src="/snippets/version-number-cli.mdx"/>"
52-
}
53-
```
54-
55-
Every time you run a fern CLI command, the CLI downloads itself at the correct version to ensure determinism.
46+
<Markdown src="/snippets/fern-config-json-reference.mdx" />
5647

5748
### `generators.yml`
5849

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

7364
1. **Create repositories**: Set up your source repository, plus one repository for each SDK
7465
2. **Install Fern GitHub App**: Install the [Fern GitHub App](https://github.com/apps/fern-api) on all repositories
75-
3. **Configure `generators.yml`**: In your `generators.yml`, add a reference to each SDK repository.
66+
3. **Configure `generators.yml`**: In your `generators.yml`, add a reference to each SDK repository.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## What is fern.config.json?
2+
3+
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.
4+
5+
### Schema
6+
7+
The `fern.config.json` file has two required fields:
8+
9+
- **`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/).
10+
11+
- **`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.
12+
13+
### Examples
14+
15+
<Tabs>
16+
<Tab title="Pinned version (recommended for CI)">
17+
18+
```json title="fern.config.json"
19+
{
20+
"organization": "plant-catalog",
21+
"version": "<Markdown src="/snippets/version-number-cli.mdx"/>"
22+
}
23+
```
24+
25+
Pinning to a specific version ensures deterministic builds. Every time you run a Fern CLI command, the CLI downloads itself at the specified version.
26+
27+
</Tab>
28+
<Tab title="Local development">
29+
30+
```json title="fern.config.json"
31+
{
32+
"organization": "plant-catalog",
33+
"version": "*"
34+
}
35+
```
36+
37+
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.
38+
39+
</Tab>
40+
</Tabs>
41+
42+
### When to change these values
43+
44+
- **`organization`**: Rarely needs to be changed. Only update this if your organization identifier changes in the Fern Dashboard.
45+
46+
- **`version`**: Use the `fern upgrade` command to update to the latest CLI version. The command automatically updates this field in `fern.config.json` and upgrades generators in `generators.yml` to their minimum-compatible versions.
47+
48+
### How the CLI uses this file
49+
50+
The following CLI commands read from `fern.config.json`:
51+
52+
- **`fern check`**: Validates the configuration file
53+
- **`fern upgrade`**: Updates the `version` field to the latest CLI version
54+
- **`fern token`**: Uses the `organization` field to generate organization-specific tokens
55+
- **`fern init`**: Creates this file when initializing a new project
56+
57+
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.

0 commit comments

Comments
 (0)