Skip to content

fern-api/docs-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation


logo

Docs Starter

Create beautiful documentation in under 5 minutes using your OpenAPI specification.

Customer Showcase

Get inspired by API documentation built with Fern: Webflow | Cartesia | Cohere | ElevenLabs


Requirements

  • Node 18 or higher
  • A GitHub account
  • Knowledge of the command line

Step 1: Use this template

  1. Click on the Use this template button (found at the top right of this page). You must be logged into GitHub.
  2. Choose the option to create a new repository. Name it fern-docs.
  3. Install the Fern Command Line Interface (CLI) by running:
npm install -g fern-api

Step 2: Clone and open the repo in your preferred code editor

Clone your newly created repository and open it in your favorite code editor (e.g., Cursor, VS Code).

The files and folders discussed in the following steps will be inside the fern/ folder in your repository.

Step 3: Customize your organization name

You need to replace "plantstore" with your own organization name in two files:

1. Update fern.config.json: Open the fern.config.json file and change the organization name:

{
  "organization": "your-company-name",
  "version": "0.84.1"
}

Run the following command to ensure you are using the latest version of Fern:

fern upgrade

Replace plantstore with your own organization's name. Use only alphanumeric characters, hyphens, and underscores.

2. Update docs.yml: Open the docs.yml file and change the instances.url value from plantstore to your company name that you used for the organization name. Do not use spaces and leave the rest of the URL (docs.buildwithfern.com) unchanged.

It should now read:

instances:
  - url: your-company-name.docs.buildwithfern.com

Step 4: Generate your documentation

Run the following command:

fern generate --docs

You will be prompted to log in and connect your GitHub account.

You might also be prompted, yes or no, about if you want to proceed with generating docs and informed that you can choose between using the --preview flag or not. You can choose to use either fern generate --docs or fern generate --docs --preview at this time. This decision is important later, when you are making changes that might affect a production docs environment, but it won't impact your docs project now.

Once the documentation is generated, you will receive the URL where your documentation is published. For example:

┌─
│ ✓  your-company-name.docs.buildwithfern.com
└─

Step 5: Try local development

Preview your documentation locally. Run ​fern docs dev​ to access your docs on your local server at port 3000, hot-reloading as you edit your markdown and OpenAPI files. Learn more or watch a 10-second demo.

Step 6: Preview your documentation

You can generate documentation previews

Generate previews from CLI

To preview updates to your documentation before publishing changes, run fern generate --docs --preview.

Configure PR previews

Your quickstart Fern project also includes GitHub Actions, including an action that enables generating previews in PRs. You don't need to update anything in the GitHub actions, but you do need to create a FERN_TOKEN auth token to enable them.

  1. Open your GitHub repository and create a new repository secret.
  2. For the Name, use FERN_TOKEN.
  3. In your local terminal, run fern token to generate an auth token value.
  4. Copy the output from your terminal, and paste in GitHub as the Value.
  5. Save your new secret.

You might need to re-run preview builds for any PRs that were opened before you configured the FERN_TOKEN.

For more information about built-in automation for previews and the preview-docs.yml GitHub action, see the Previewing changes in a PR Fern docs.

Step 7: Customize your documentation

You must run fern generate --docs after any modifications to re-generate and publish your documentation site.

To use your own OpenAPI specification file or to update the existing one:

  • Update or replace the OpenAPI specification file in the openapi/ folder.
  • Note: Don't have an OpenAPI spec? Use Fern's simpler format to define your API. Learn more.

To modify the other docs pages:

  • Update the Markdown files located in the docs/pages/ folder, such as welcome.mdx.

To modify site styles and navigation, or to add new pages:

To learn about Fern's built-in component library you can use within MDX files:

Step 7: Set up a custom domain

If you wish to use a custom subdomain like https://docs.YOUR_ORGANIZATION.com or a subpath like https://YOUR_ORGANIZATION.com/docs, you can subscribe to the Starter plan. Once subscribed, update docs.yml with the custom domain configuration:

- url: plantstore.docs.buildwithfern.com
  custom-domain: plantstore.dev

Step 8: Explore advanced features

For advanced documentation features and options, view the full project structure.

Good luck creating beautiful and functional documentation! 🌿


Support

Need help? Set up a call with an expert or email us at [email protected].

About

Publish beautiful documentation from OpenAPI and markdown (MDX)

Topics

Resources

Stars

Watchers

Forks

Contributors 14

Languages