In this quickstart, we’ll install Fern, initialize a sample API, and generate a TypeScript Node.js SDK. The output files will be downloaded to your local file system.
We’ll use a Fern Definition to describe our endpoints, types, and errors. Alternatively, you can use an OpenAPI specification.
Prerequisites
- Node.js 18 or higher
Step 1: Install Fern
Step 2: Initialize Fern
This will create a fern/
directory which contains a sample API and configuration. This generally lives in your backend repo, but you can also have an independent repo dedicated to your API (like Seam’s).
The example API we’ll use is inspired by IMDb (International Movie Database). We’ll see an endpoint for creating and retrieving a Movie
.
Step 3: Generate code
By default, generators.yml
contains the TypeScript Node.js generator.
To invoke the generator, run:
By default, Fern runs the generator in the cloud, compiles your API definition into files, and downloads them to your computer. Once complete, you’ll see new files in /generated/sdks/typescript/
.
Note: The generated/
directory will be created at the root level of your repository, one level up from the fern/
folder.
What’s next
Congratulations! You installed Fern, initialized a sample API, and generated your first SDK.
As a next step, you can:
- Use an OpenAPI specification
- Define your API as a Fern Definition
- Configure additional code generators
- Publish the Node.js SDK to npm & GitHub paid feature