generated from fern-api/docs-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 60b01b8
Showing
13 changed files
with
1,251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: fern-check | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Fern | ||
run: npm install -g fern-api | ||
|
||
- name: Check API is valid | ||
run: fern check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: generate-sdks | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Fern | ||
run: npm install -g fern-api | ||
|
||
- name: Generate SDKs | ||
env: | ||
FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | ||
run: | | ||
fern generate --group publish --log-level debug --version ${{ github.ref_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: preview-docs | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Fern | ||
run: npm install -g fern-api | ||
|
||
- name: Generate preview URL | ||
id: generate-docs | ||
env: | ||
FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | ||
run: | | ||
OUTPUT=$(fern generate --docs --preview 2>&1) || true | ||
echo "$OUTPUT" | ||
URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()') | ||
echo "Preview URL: $URL" | ||
echo "🌿 Preview your docs: $URL" > preview_url.txt | ||
- name: Comment URL in PR | ||
uses: thollander/[email protected] | ||
with: | ||
filePath: preview_url.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: publish-docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/main') | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Fern | ||
run: npm install -g fern-api | ||
|
||
- name: Publish Docs | ||
env: | ||
FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | ||
run: fern generate --docs --log-level debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<br/> | ||
<div align="center"> | ||
<a href="https://www.buildwithfern.com/?utm_source=github&utm_medium=readme&utm_campaign=docs-starter-openapi&utm_content=logo"> | ||
<img src="/fern/docs/assets/logo_light_mode.png" height="50" align="center" alt="header" /> | ||
</a> | ||
|
||
<br/> | ||
|
||
# Docs Starter | ||
|
||
Create beautiful documentation in under 5 minutes using an OpenAPI/Swagger specification. Here's [an example!](https://petstore-openapi.docs.buildwithfern.com) | ||
|
||
[![Discord](https://img.shields.io/badge/Join%20Our%20Community-black?logo=discord)](https://discord.com/invite/JkkXumPzcG) | ||
|
||
</div> | ||
|
||
--- | ||
|
||
## Customer Showcase | ||
|
||
Your docs can look this good: | ||
|
||
- [Flatfile's API Reference](https://reference.flatfile.com/api-reference/events/create-an-event) | ||
- [Sugeragent's Docs](https://docs.superagent.sh/) | ||
- [Credal's Docs](https://docs.credal.ai/) | ||
|
||
--- | ||
|
||
## Let's get started | ||
|
||
### About OpenAPI/Swagger | ||
|
||
The OpenAPI specification is a format for describing REST APIs. The specification consists of a single JSON or YAML file. OpenAPI was previously known as Swagger. Fern supports both OpenAPI (3.x) and Swagger (2.x). We'll refer to the specification as OpenAPI throughout this guide. | ||
|
||
### Step 1: Use this template | ||
|
||
1. Click on the "Use this template" button. You must be logged into GitHub. | ||
2. Create a new repository. Name it anything you like; `docs` is a common naming choice. | ||
|
||
### Step 2: Clone and open in your preferred code editor | ||
|
||
Clone your newly created repository and open it in your favorite integrated development environment (IDE) or code editor. | ||
|
||
The files and folders discussed in the following steps will be inside a `fern` folder in your repository. | ||
|
||
### Step 3: Customize organization name | ||
|
||
In the `fern.config.json` file, replace the placeholder organization name with your actual organization name. For example: | ||
|
||
```json | ||
{ | ||
"organization": "Petstore", | ||
"version": "0.17.2" | ||
} | ||
``` | ||
|
||
In the `docs.yml` file, update the docs URL to match your organization's naming convention. For example: | ||
|
||
```yml | ||
instances: | ||
- url: petstore-openapi.docs.buildwithfern.com | ||
``` | ||
### Step 4: Install the Fern CLI | ||
Install the Fern CLI globally by running: | ||
```bash | ||
npm install -g fern-api | ||
``` | ||
|
||
As this is a global command, you can run it from any location. The CLI commands in the following steps must be run from within your repository. | ||
|
||
### Step 5: (Optional) Use your OpenAPI specification | ||
|
||
If you'd like to use the an example OpenAPI specificaton file, run: | ||
|
||
```bash | ||
fern init --openapi https://petstore3.swagger.io/api/v3/openapi.json | ||
``` | ||
|
||
If you'd like to use your own OpenAPI specification file, run: | ||
|
||
```bash | ||
fern init --openapi URL_OR_PATH_TO_YOUR_OPENAPI_SPEC | ||
``` | ||
|
||
You can use a URL to an OAS file online, or you can use a local path. The file must be formatted as JSON or YAML. | ||
|
||
Examples: | ||
|
||
```fern init --openapi https://petstore3.swagger.io/api/v3/openapi.json``` | ||
|
||
```fern init --openapi ../apis/openapi.yml``` | ||
|
||
Confirm that you see a new folder named `openapi` and that it contains the OAS file you specified, in YAML format. | ||
|
||
*Note: Don't have an OpenAPI spec? Use Fern's simpler format to define your API.* [*Learn more*](https://github.com/fern-api/docs-starter-fern-definition) | ||
|
||
### Step 6: Check that your OpenAPI specification is valid | ||
|
||
Run the following command to check that your OpenAPI specification is valid: | ||
|
||
```bash | ||
fern check | ||
``` | ||
|
||
If you see errors, resolve them in your OpenAPI specification file. If you need help, reach out in [Discord](https://discord.com/invite/JkkXumPzcG) or [via email](mailto:[email protected]). We're here to help! | ||
|
||
### Step 7: Generate your documentation | ||
|
||
Generate and publish your documentation with the following command: | ||
|
||
```bash | ||
fern generate --docs | ||
``` | ||
|
||
You will be prompted to log in and connect your GitHub account. | ||
|
||
Once the documentation is generated, you will receive a URL where your documentation is published. For example: | ||
|
||
```shell | ||
┌─ | ||
│ ✓ petstore-openapi.docs.buildwithfern.com | ||
└─ | ||
``` | ||
|
||
### Step 8: Customize your documentation | ||
|
||
Next, modify the markdown pages located in the `docs/pages` folder, such as the Welcome page. | ||
|
||
Further tailor your documentation to match your brand by adjusting settings in the `docs.yml` file. | ||
|
||
To re-publish the updates to your documentation, run `fern generate --docs` again. | ||
|
||
To preview updates to your documentation before publishing changes, run `fern generate --docs --preview`. | ||
|
||
Fern has a built-in component library for you to use. [Explore the components.](https://docs.buildwithfern.com/generate-docs/component-library/) | ||
|
||
### Step 9: 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](https://buildwithfern.com/pricing). Once subscribed, update `docs.yml` with the custom domain configuration: | ||
|
||
``` yaml | ||
- url: petstore-openapi.docs.buildwithfern.com | ||
custom-domain: docs.petstore-openapi.com | ||
``` | ||
### Step 10: Explore advanced features | ||
For advanced documentation features and options, view the full [configuration docs](https://docs.buildwithfern.com/generate-docs/overview/configuration). | ||
Good luck creating beautiful and functional documentation! 🌿 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
instances: | ||
- url: petstore-openapi.docs.buildwithfern.com | ||
|
||
navigation: | ||
- section: Get Started | ||
contents: | ||
- page: Welcome | ||
path: ./docs/pages/welcome.mdx | ||
- page: SDKs | ||
path: ./docs/pages/sdks.mdx | ||
slug: sdks | ||
- api: API Reference | ||
|
||
navbar-links: | ||
- type: secondary | ||
text: Contact us | ||
url: "mailto:[email protected]" | ||
- type: primary | ||
text: Join the Discord | ||
url: https://discord.com/invite/JkkXumPzcG | ||
|
||
colors: | ||
accentPrimary: | ||
dark: "#adff8c" | ||
light: "#376d20" | ||
|
||
logo: | ||
dark: ./docs/assets/logo_dark_mode.png | ||
light: ./docs/assets/logo_light_mode.png | ||
height: 30 | ||
|
||
favicon: ./docs/assets/favicon.ico |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: Fern Docs | SDKs | ||
description: We offer client libraries/SDKs for your favorite languages, generated by Fern from your OpenAPI specification file. | ||
--- | ||
|
||
We provide official open-source SDKs (client libraries) for your favorite languages, such as Node.js and Python. These clients make connecting to our API faster and help avoid errors. | ||
|
||
We regularly update our SDKs using [Fern](https://buildwithfern.com/?utm_source=str-d/sdks) and adhere to [semantic versioning](https://semver.org/) (semver) principles, so we won't make breaking changes in minor or patch releases. | ||
|
||
## Official SDKs | ||
|
||
<br /> | ||
|
||
<Cards> | ||
<Card | ||
title="Node.js" | ||
icon="fa-brands fa-js" | ||
href="https://github.com/fern-api/fern-typescript" | ||
/> | ||
<Card | ||
title="Python" | ||
icon="fa-brands fa-python" | ||
href="https://github.com/fern-api/fern-python" | ||
/> | ||
<Card | ||
title="Java" | ||
icon="fa-brands fa-java" | ||
href="https://github.com/fern-api/fern-java" | ||
/> | ||
<Card | ||
title="Go" | ||
icon="fa-brands fa-golang" | ||
href="https://github.com/fern-api/fern-go" | ||
/> | ||
<Card | ||
title="Ruby" | ||
icon="fa-solid fa-gem" | ||
href="https://github.com/fern-api/fern-ruby" | ||
/> | ||
<Card | ||
title="C#" | ||
icon="fa-solid fa-hashtag" | ||
href="https://github.com/fern-api/fern-csharp" | ||
/> | ||
</Cards> | ||
|
||
## Request a new SDK | ||
|
||
If you'd like to request an SDK for a language that we don't currently support, please [open an issue](https://github.com/fern-api/fern/labels/new-language). We prioritize languages based on demand. |
Oops, something went wrong.