Code Snippets

Pro Feature

This feature is only available on paid plans. Please schedule a demo or email us to get started.

Fern generates code snippets of how to consume the SDK in various languages. These code snippets are embedded in a variety of different locations:

Snippets in the SDK

Each SDK contains code snippets so that users can see usage examples on hover. See examples below:

1export interface MovieClient {
2 /**
3 * Create a new movie
4 * @param request: a request to create a movie
5 *
6 * @example
7 * const response = await client.movie.create({
8 * title: 'Inception',
9 * year: 2010,
10 * director: 'Christopher Nolan'
11 * });
12 */
13 create(request: CreateMovieRequest): Promise<CreateMovieResponse>;
14}

Snippets in documentation

If you use Fern to generate your developer documentation, then you can configure the code snippets to be automatically populated in your documentation.

Code snippets

Automatically populated code snippets

Snippets over API

We also provide a public API that you can use to fetch code snippets. This is useful if you want to display code snippets in your own documentation or website.

Code snippets

merge.dev uses the snippets API to populate their documentation