|
1 | 1 | --- |
2 | 2 | title: Quickstart |
3 | | -subtitle: Set up the fern folder |
4 | 3 | --- |
5 | 4 |
|
6 | 5 | Configuring Fern starts with the `fern` folder, the root directory that contains |
7 | | -your API definitions, generators, and your CLI version. |
8 | | - |
9 | | -## Set up the fern folder |
| 6 | +your API definitions, SDK generators, and CLI version. |
10 | 7 |
|
11 | 8 | <Steps> |
| 9 | +<Step title="Install the Fern CLI"> |
12 | 10 |
|
13 | | -<Markdown src="/products/sdks/snippets/install-cli.mdx"/> |
14 | | - |
15 | | - ### Initialize the Fern Folder |
16 | | - |
17 | | - <Markdown src="/products/sdks/snippets/initialize-fern-folder-intro.mdx"/> |
| 11 | + ```bash |
| 12 | + npm install -g fern-api |
| 13 | + ``` |
| 14 | +</Step> |
| 15 | + <Step title="Initialize the fern folder"> |
| 16 | + Initialize the fern folder with your existing OpenAPI specification, or start from scratch with a Fern Definition template. Specify your organization name using the `--organization` flag. |
18 | 17 |
|
19 | | - <AccordionGroup> |
20 | | - <Markdown src="/products/sdks/snippets/option-1-openapi.mdx"/> |
| 18 | + ```bash |
| 19 | + # OpenAPI (local) |
| 20 | + fern init --openapi path/to/openapi.yml \ |
| 21 | + --organization <YourOrganization> |
21 | 22 |
|
22 | | - <Accordion title="Option 2: Fern Definition"> |
23 | | - |
24 | | - <Markdown src="/products/sdks/snippets/option-2-fern-def.mdx"/> |
25 | | - </Accordion> |
| 23 | + # OpenAPI (URL) |
| 24 | + fern init --openapi https://api.example.com/openapi.yml \ |
| 25 | + --organization <YourOrganization> |
26 | 26 |
|
27 | | - {/* <Markdown src="/products/sdks/snippets/option-3-asyncapi.mdx"/> */} |
28 | | - </AccordionGroup> |
| 27 | + # Fern Definition |
| 28 | + fern init --organization <YourOrganization> |
| 29 | + ``` |
| 30 | + <Tip> |
| 31 | + OpenAPI accepts both JSON and YAML formats. You can always convert a [Fern Definition to OpenAPI](/api-definitions/ferndef/export-openapi) or OpenAPI to a Fern Definition later on. |
| 32 | + </Tip> |
| 33 | + |
| 34 | + This creates a `fern` folder in your current directory. |
| 35 | + <Tabs> |
| 36 | + <Tab title="OpenAPI"> |
| 37 | + <Files> |
| 38 | + <Folder name="fern" defaultOpen> |
| 39 | + <File name="fern.config.json" comment="root-level configuration" /> |
| 40 | + <Folder name="api" defaultOpen comment="your API"> |
| 41 | + <File name="generators.yml" comment="generators you're using" /> |
| 42 | + <Folder name="openapi" defaultOpen> |
| 43 | + <File name="openapi.yml" comment="API-level configuration" /> |
| 44 | + </Folder> |
| 45 | + </Folder> |
| 46 | + </Folder> |
| 47 | + </Files> |
| 48 | + </Tab> |
| 49 | + <Tab title="Fern Definition"> |
| 50 | + <Files> |
| 51 | + <Folder name="fern" defaultOpen> |
| 52 | + <File name="fern.config.json" comment="root-level configuration" /> |
| 53 | + <File name="generators.yml" comment="generators you're using" /> |
| 54 | + <Folder name="definition" defaultOpen> |
| 55 | + <File name="api.yml" comment="API-level configuration" /> |
| 56 | + <File name="imdb.yml" comment="endpoints, types, and errors" /> |
| 57 | + </Folder> |
| 58 | + </Folder> |
| 59 | + </Files> |
29 | 60 |
|
30 | | - ### Next: Set up your repository structure |
| 61 | + <Note> `imdb.yml` contains an example movies API. If you’re just |
| 62 | + generating an SDK for test purposes, you can leave this file as it is. To |
| 63 | + generate an SDK for your own API instead of the example movies API, |
| 64 | + replace `imdb.yml` with your own endpoints, types, and errors. </Note> |
| 65 | + </Tab> |
| 66 | + </Tabs> |
| 67 | + </Step> |
| 68 | + <Step title="Next steps"> |
31 | 69 |
|
32 | | - Now that you have your `fern` folder initialized, [learn how to organize your repositories for SDK generation](/sdks/overview/project-structure). |
33 | | - |
| 70 | + <CardGroup cols={2}> |
| 71 | + <Card title="Learn about project structure" icon="regular folder-tree" href="/learn/sdks/overview/project-structure"> |
| 72 | + Understand how to organize your API definitions and generators. |
| 73 | + </Card> |
| 74 | + <Card title="Generate SDKs" icon="regular code" href="/learn/sdks/overview/introduction"> |
| 75 | + Explore all supported languages. |
| 76 | + </Card> |
| 77 | + <Card title="Build with TypeScript" icon="regular rocket" href="/learn/sdks/generators/typescript/quickstart"> |
| 78 | + Get started with TypeScript SDK generation. |
| 79 | + </Card> |
| 80 | + <Card title="Add custom code" icon="regular code-branch" href="/learn/sdks/overview/custom-code"> |
| 81 | + Extend your generated SDKs with custom functionality. |
| 82 | + </Card> |
| 83 | + </CardGroup> |
| 84 | + </Step> |
34 | 85 | </Steps> |
0 commit comments