|
| 1 | +--- |
| 2 | +title: How SDKs work |
| 3 | +description: Learn how Fern generates SDKs using cloud infrastructure |
| 4 | +--- |
| 5 | + |
| 6 | +Fern combines your API specifications with generator configurations and custom code to produce SDKs in multiple languages. By default, SDK generation runs on Fern's managed cloud infrastructure. |
| 7 | + |
| 8 | +<Info> |
| 9 | + Alternatively, [you can run SDK generation on your own infrastructure](/sdks/deep-dives/self-hosted) to meet specific security or compliance requirements. |
| 10 | +</Info> |
| 11 | + |
| 12 | +## Generation workflow |
| 13 | + |
| 14 | +Before generating SDKs, you'll configure your `fern/` folder with SDK generators specified in `generators.yml` and connect your API specification. You can also add custom code, tests, and other configuration as needed. |
| 15 | + |
| 16 | +Running `fern generate` kicks off the cloud generation process and involves a few key steps: |
| 17 | + |
| 18 | +<Steps> |
| 19 | +<Step title="Cloud execution"> |
| 20 | +Fern allocates compute resources and pulls the appropriate Docker image for your specified generator version. |
| 21 | +</Step> |
| 22 | +<Step title="Generate core SDK"> |
| 23 | +The Docker container executes the generation logic and produces your SDK's core files (models, client code, API methods). |
| 24 | +</Step> |
| 25 | +<Step title="Verify organization"> |
| 26 | +Fern verifies your organization registration to ensure the complete SDK can be generated. Without organization verification, only partial SDK files (core code without package metadata) are produced. |
| 27 | +</Step> |
| 28 | +<Step title="Add package metadata"> |
| 29 | +Fern completes the SDK by adding package distribution files such as `pyproject.toml`, `package.json`, README, and any dependencies. |
| 30 | +</Step> |
| 31 | +<Step title="Output to destination"> |
| 32 | +Fern publishes or saves the complete SDK to your configured location (local filesystem, GitHub repository, package registry). After publication, developers can use your SDKs to integrate with your APIs. |
| 33 | +</Step> |
| 34 | +</Steps> |
| 35 | + |
| 36 | +<Accordion title="Architecture diagram" toc={true}> |
| 37 | + |
| 38 | +```mermaid |
| 39 | +sequenceDiagram |
| 40 | + autonumber |
| 41 | + participant Dev as Developer |
| 42 | + participant Fern as Fern |
| 43 | + participant Docker as Docker Container |
| 44 | + participant Dest as Output Destination |
| 45 | + |
| 46 | + Dev->>Fern: fern generate |
| 47 | + Fern->>Fern: Allocate cloud compute |
| 48 | + Fern->>Docker: Pull & run generator image |
| 49 | + Docker->>Docker: Generate core SDK files |
| 50 | + Docker->>Fern: Return partial SDK |
| 51 | + Fern->>Fern: Verify organization |
| 52 | + Fern->>Fern: Add package metadata |
| 53 | + Fern->>Dest: Output complete SDK |
| 54 | +``` |
| 55 | +</Accordion> |
0 commit comments