Skip to content

fern-api/fern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12,183 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🌿 What is Fern?

Fern is a platform that transforms your API definitions into production-ready SDKs and beautiful documentation in minutes.

With Fern, you can offer your users:

  • 🧩 Type-safe SDKs in multiple languages, including TypeScript, Python, Java, Go, Ruby, PHP, and C#
  • 📘 Developer documentation featuring an interactive UI and auto-generated API + SDK references
  • AI Search powered by an assistant trained on your docs, APIs, and SDKs that can instantly answer a developer's questions

Fern supports leading API specifications including OpenAPI (REST, Webhooks), AsyncAPI (WebSockets), Protobuf (gRPC), and OpenRPC.

🌿 SDKs

The Fern platform is available via a command line interface (CLI) and requires Node 18+. To install it, run:

npm install -g fern-api

Initialize Fern with your OpenAPI spec:

fern init --openapi ./path/to/openapi.yml
# or
fern init --openapi https://link.buildwithfern.com/plantstore-openapi

Your directory should look like the following:

fern/
├─ fern.config.json
├─ generators.yml # generators you're using
└─ openapi/
  └─ openapi.json # your openapi document

Finally, to invoke the generator, run:

fern generate

🎉 Once the command completes, you'll see your SDK in /generated/sdks/typescript.

🌿 API Documentation

Fern can also build and host a documentation website with an auto-generated API reference. Write additional pages in markdown and have them versioned with git. Search, SEO, dark mode, and popular components are provided out-of-the-box. Plus, you can customize the colors, font, logo, and domain name.

Check out docs built with Fern:

Get started here.

🌿 Generators

Generators are processes that take your API Definition as input and output artifacts (SDKs, Postman Collections, Server boilerplate, etc.). To add a generator, run fern add <generator id>.

SDK Generators

Generator ID Latest Version Changelog
fernapi/fern-typescript-sdk Typescript Generator Version Changelog
fernapi/fern-python-sdk Python Generator Version Changelog
fernapi/fern-java-sdk Java Generator Version Changelog
fernapi/fern-ruby-sdk Ruby Generator Version Changelog
fernapi/fern-go-sdk Go Generator Version Changelog
fernapi/fern-csharp-sdk C# Generator Version Changelog
fernapi/fern-php-sdk PHP Generator Version Changelog
fernapi/fern-swift-sdk Swift Generator Version Changelog
fernapi/fern-rust-sdk Rust Generator Version Changelog

Model Generators

Fern's model generators will output schemas or types defined in your OpenAPI spec or Fern Definition.

Generator ID Latest Version Changelog
fernapi/fern-pydantic-model Pydantic Model Generator Version versions.yml
fernapi/fern-java-model Java Model Generator Version versions.yml
fernapi/fern-go-model Go Model Generator Version versions.yml

Spec Generators

Fern's spec generators can output an OpenAPI spec or a Postman collection.

Note: The OpenAPI spec generator is primarily intended for Fern Definition users. This prevents lock-in so that one can always export to OpenAPI.

Generator ID Latest Version Changelog
fernapi/fern-openapi OpenAPI Generator Version versions.yml
fernapi/fern-postman Postman Generator Version versions.yml

🌿 CLI Commands

Here's a quick look at the most popular CLI commands. View the documentation for all CLI commands.

fern init: adds a new starter API to your repository.

fern check: validate your API definition and Fern configuration.

fern generate: run the generators specified in generators.yml in the cloud.

fern generate --local: run the generators specified in generators.yml in docker locally.

fern add <generator>: include a new generator in your generators.yml. For example, fern add fern-python-sdk.

Inspiration

Fern is inspired by internal tooling built to enhance the developer experience. We stand on the shoulders of giants. While teams were responsible for building the following tools, we want to give a shout out to Mark Elliot (creator of Conjure at Palantir), Michael Dowling (creator of Smithy at AWS), and Ian McCrystal (creator of Stripe Docs).

Community

Join our Slack! We are here to answer questions and help you get the most out of Fern.

Contributing

We welcome community contributions. For guidelines, refer to our CONTRIBUTING.md. To contribute to our documentation, refer to our docs repo.

Development Environment

This repository uses DevBox for reproducible development environments. DevBox provides cross-platform support (Mac, Linux, Windows via WSL) with exact version pinning based on Nix.

To get started:

# Install DevBox (https://www.jetify.com/devbox/docs/installing_devbox/)
curl -fsSL https://get.jetify.com/devbox | bash

# Enter the development environment
devbox shell

DevBox automatically installs all required dependencies including Node.js, pnpm, Go, Python, Poetry, JDK, and buf with pinned versions matching CI.

Fern Contributors