For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Book a demoLog inStart for free
  • Overview
    • Introduction
    • How it works
    • Quickstart
    • Customer showcase
  • Working with SDKs
    • Project structure
    • Adding custom code
    • Migrating to Replay
    • Capabilities
  • Generators
      • Generating an SDK
      • Publishing to npm
      • Configuration
      • Adding custom code
      • Dynamic authentication
      • Enabling the serde layer
      • Changelog
      • Customer showcase
  • Reference
    • generators.yml
Checking status...
SOC2Soc 2 Type II
© 2026 Fern • Birch Solutions, Inc., a Postman company

Documentation

SDKsDocsAsk FernCLI Reference

API Definitions

OpenAPIAsyncAPIOpenRPCgRPC

Resources

BlogSupportPricing

Company

Brand KitPrivacy PolicyTerms of Service
LogoLogo
Book a demoLog inStart for free
GeneratorsTypeScript

Generating an SDK

||View as Markdown|
Was this page helpful?
Edit this page
Previous

Capabilities

Next

Publishing to npm

Generate a TypeScript SDK by following the instructions on this page.

Already completed the Quickstart? Skip ahead to Set up GitHub repositories.

1

Install the Fern CLI

$npm install -g fern-api
2

Initialize the fern folder

Initialize the fern folder with your existing OpenAPI specification. Specify your organization name using the --organization flag.

$fern init --openapi path/to/openapi.yml \
>--organization <YourOrganization>

OpenAPI accepts both JSON and YAML formats.

This creates a fern folder in your current directory.

fern
fern.config.json# root-level configuration
api# your API
generators.yml# generators you're using
openapi
openapi.yml# API-level configuration
3

Validate your API definition

Check that your API definition is valid, and fix errors before proceeding:

$fern check
4

Add the SDK generator

Run the following command to add the TypeScript SDK generator to generators.yml:

$fern add fern-typescript-sdk --group {{GROUP_NAME}}

This command adds the following group to generators.yml:

generators.yml
1 ts-sdk: # group name
2 generators:
3 - name: fernapi/fern-typescript-sdk
4 version: 3.69.0
5 output:
6 location: local-file-system
7 path: ../sdks/typescript

fern init includes a TypeScript SDK generator by default. If you already ran fern init and haven’t modified generators.yml, you can skip this step.

5

Generate the SDK

Run the following command to generate your SDK:

$fern generate --group ts-sdk

If you have multiple APIs, use the --api flag to specify the API you want to generate:

$fern generate --group ts-sdk --api your-api-name

This creates a sdks folder in your current directory. The resulting folder structure looks like this:

fern# created by fern init
sdks# created by fern generate --group ts-sdk
typescript
Client.ts
index.ts
errors
core
api
6

Set up GitHub repositories

Fern uses a multi-repo structure: your source repository contains the fern/ folder, and each SDK gets its own separate repository.

  1. Create a source repository for your fern/ folder if you don’t have one already (e.g., your-org/your-api-definitions).
  2. Create an SDK repository for your SDK (e.g., your-org/your-api-typescript-sdk).
  3. Install the Fern GitHub App on both repositories.
7

Publish to npm

Follow the Publishing to npm guide to configure your package and set up automated publishing via GitHub Actions.