Fern TypeScript Server Tutorial
+ + + ## How does it work? ![Overview diagram](assets/diagrams/overview-diagram.png) @@ -30,12 +35,12 @@ With an API definition, development projects that involve multiple engineers/tea ## What is a Fern API Definition? -A [**Fern API Definition**](markdown_files/definition.md#what-is-a-fern-api-definition) is a set of YAML files that describe your API. +A [**Fern API Definition**](_/definition.md#what-is-a-fern-api-definition) is a set of YAML files that describe your API. ## What are Fern Generators? -[**Generators**](markdown_files/generators.md) convert a Fern API Definition into clients, servers, and documentation. +[**Generators**](_/generators.md) convert a Fern API Definition into clients, servers, and documentation. ## How is this different than OpenAPI? -Fern is optimized for [kick-ass codegen](markdown_files/faq.md#_1-how-is-fern-different-than-openapi-fka-swagger). +Fern is optimized for [kick-ass codegen](_/comparison.md#_1-how-is-fern-different-than-openapi-fka-swagger). diff --git a/docs/markdown_files/channels.md b/docs/_/channels.md similarity index 100% rename from docs/markdown_files/channels.md rename to docs/_/channels.md diff --git a/docs/markdown_files/cli.md b/docs/_/cli.md similarity index 100% rename from docs/markdown_files/cli.md rename to docs/_/cli.md diff --git a/docs/_/comparison.md b/docs/_/comparison.md new file mode 100644 index 00000000000..b4b4f6da233 --- /dev/null +++ b/docs/_/comparison.md @@ -0,0 +1,7 @@ +# How is Fern different than OpenAPI (f.k.a Swagger)? + +- **Higher-quality code generation**: Fern is more restrictive in what you can model, enabling idiomatic, easy-to-use code generation. + +- **Protocol agnostic**: Fern lets you define RESTful services alongside WebSocket subscriptions. + +- **Ease of use**: Fern runs code generators remotely and manages publishing packages to registries (e.g., NPM, Maven, PyPI). You get a dependency that you can start using right away. diff --git a/docs/markdown_files/definition.md b/docs/_/definition.md similarity index 100% rename from docs/markdown_files/definition.md rename to docs/_/definition.md diff --git a/docs/markdown_files/errors.md b/docs/_/errors.md similarity index 100% rename from docs/markdown_files/errors.md rename to docs/_/errors.md diff --git a/docs/markdown_files/fern-config-json.md b/docs/_/fern-config-json.md similarity index 100% rename from docs/markdown_files/fern-config-json.md rename to docs/_/fern-config-json.md diff --git a/docs/markdown_files/fernrc.md b/docs/_/fernrc.md similarity index 100% rename from docs/markdown_files/fernrc.md rename to docs/_/fernrc.md diff --git a/docs/markdown_files/generators.md b/docs/_/generators.md similarity index 81% rename from docs/markdown_files/generators.md rename to docs/_/generators.md index c24490b78db..e9286b362f4 100644 --- a/docs/markdown_files/generators.md +++ b/docs/_/generators.md @@ -13,3 +13,15 @@ | | | | OpenAPI | converts a Fern Definition to an [OpenAPI Spec](https://swagger.io/resources/open-api/) | fern add openapi | [fern-openapi](https://github.com/fern-api/fern-openapi) | | | | + +## How does remote code generation work? + +Code generators run remotely in the cloud. They take a set of Fern API Definition YAML files, run the generators listed in `.fernrc.yml, and produce generated files as an output. Files can output locally (i.e., seen in the file system of your IDE) or remotely (i.e., in a package manager like NPM, Maven, or PyPI). + +### Generating clients + +![client generators](../assets/diagrams/frontend-diagram.png) + +### Generating servers + +![server generators](../assets/diagrams/backend-diagram.png) diff --git a/docs/markdown_files/ids.md b/docs/_/ids.md similarity index 100% rename from docs/markdown_files/ids.md rename to docs/_/ids.md diff --git a/docs/markdown_files/imdb.md b/docs/_/imdb.md similarity index 63% rename from docs/markdown_files/imdb.md rename to docs/_/imdb.md index 5b199de824e..6440fe0e572 100644 --- a/docs/markdown_files/imdb.md +++ b/docs/_/imdb.md @@ -1,9 +1,14 @@ -# Tutorial: IMDb +# TypeScript Server Tutorial: IMDb This guide uses an example API for IMDb (the International Movie Database) that introduces you to using Fern. We'll generate a TypeScript server and a Postman Collection to implement and test our API. + +Video walkthrough
+ + + ## Step 0: Prerequisites - Install [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) @@ -32,6 +37,10 @@ In the root of your backend repo, run: fern init ``` +When it asks you for your `organization`, just write `imdb`. + +In the `.fernrc.yml`, let's change the name of our api from `api` to `imdb-api`. +