Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

ADR: Distributed SDK documentation structured with Diátaxis #271

Backlog

Description

@mathecruz

Status and context

Status: Proposed.

The serverlessworkflow.io site (Astro, deployed on Netlify) has no SDK documentation today. src/content.config.ts has a docs collection commented out, and there is no /docs route.

Committing each SDK's pages to the website repository would not scale. Each SDK's docs change with that SDK's API, but they live in a different repository and are reviewed by different people. Every API change needs a second PR on the site, and the docs drift behind.

The team proposed that each SDK repository (sdk-java, sdk-go, …) owns its documentation, and that CI aggregates and publishes everything on the site. The docs also need a defined structure from day one, so tutorial, how-to and reference content do not end up mixed on the same page.

Decision

Each SDK repository owns its documentation, organized according to Diátaxis. The website only aggregates and renders it.

  1. Each SDK keeps a docs/ folder at its root with code fragments for tutorials and how-to guides, and full reference pages. Explanation lives on the website.
  2. The website repository owns the layout, navigation and frontmatter schema. It also holds the language-agnostic prose of unified pages, but no SDK-specific content.
  3. At build time, a website script fetches each SDK's docs/ folder at a pinned ref (a release tag) and writes it to src/content/docs/<sdk>/. That directory is git-ignored.
  4. An SDK release triggers a website rebuild.
  5. Tutorials and how-to guides are unified pages: concepts are written once, and code is shown in language tabs (Java, C#, Go, …) filled from each SDK.

Diátaxis structure

Every page belongs to exactly one of the four Diátaxis types. The folder sets the type, and the type sets the route and the sidebar position.

Type Serves the reader who wants to What the SDK provides Example (Java)
Tutorial Learn by doing, from scratch Code fragments in docs/tutorials/ Steps of "Run your first workflow"
How-to guide Get a specific task done Code fragments in docs/how-to/ Code for "Call an HTTP endpoint"
Reference Look up exact facts Full pages in docs/reference/ Configuration, Maven modules, link to the Javadoc
Explanation Understand why Nothing: spec concepts live on the website Workflow lifecycle and execution model
sdk-java/
└── docs/
    ├── index.md            # SDK landing page: what it is, install, links
    ├── tutorials/          # fragments for unified tutorial pages
    │   └── getting-started.md
    ├── how-to/             # fragments for unified how-to pages
    ├── reference/          # full SDK-specific pages
    └── assets/             # images referenced by the pages

The Java SDK's first page is a getting-started tutorial at docs/tutorials/getting-started.md. Empty folders can be omitted: the sidebar only shows types that have content.

Unified pages with language tabs

Tutorials and how-to guides are one page per topic: the concepts are written once, and every code step shows a tab per SDK. The reader picks a language once (Java, C#, Go, …) and the whole site follows that choice.

flowchart LR
    shared["Shared page · website<br/>how-to/call-http.mdx<br/>concepts + SdkCode slots"] --> match
    java["Java SDK fragment<br/>docs/how-to/call-http.md"] --> match
    csharp["C# SDK fragment<br/>docs/how-to/call-http.md"] --> match
    go["Go SDK fragment<br/>docs/how-to/call-http.md"] --> match
    match["Match by slug<br/>(Astro build)"] --> page["Rendered page<br/>concepts + Java | C# | Go tabs"]
Loading
  • Shared page (website): src/content/guides/how-to/call-http.mdx holds the goal, the concepts, the workflow YAML and the expected result. It marks each code step with a slot, e.g. <SdkCode step="setup" /> and <SdkCode step="run" />.
  • SDK fragment (SDK repo): docs/how-to/call-http.md, same slug as the shared page. One ## <step> heading per slot (## setup, ## run), each holding that SDK's dependency, code and commands. Still plain Markdown.
  • Composition (website build): fragments are matched to shared pages by slug and step. Each slot renders as a tab group with one tab per SDK that provides that step.
  • Language choice: one global selector, stored in localStorage and mirrored in the URL (?lang=csharp), so a shared link opens in the right language. Every tab group on the page switches together.
  • Missing fragment: the tab shows "Not available yet" with a link to contribute to that SDK, so gaps are visible.
  • Code that stays correct: a fragment can pull code from a tested example in the SDK repo through snippet markers (// tag::call-http[]), so CI catches code that no longer compiles.
Diátaxis type Page shape Concepts live in Code lives in Route
Tutorial Unified, language tabs Website Each SDK's docs/tutorials/ /docs/tutorials/<slug>
How-to guide Unified, language tabs Website Each SDK's docs/how-to/ /docs/how-to/<slug>
Explanation Unified, no tabs (spec concepts) Website — /docs/explanation/<slug>
Reference Per SDK SDK SDK's docs/reference/ /docs/<sdk>/reference/...

The shared pages define the slugs and step names. The SDK validation workflow warns when a fragment matches no shared page or names a step the page does not have.

Content contract

A new docs content collection in src/content.config.ts defines the schema, and that schema is the contract. A file that breaks it breaks the website build, so each SDK checks the same contract in its own CI.

---
title: Getting started        # required
description: Run your first workflow with the Java SDK   # required, used for SEO and cards
order: 1                      # optional, sorts pages within a folder
---
  • Type: comes from the folder, not from frontmatter. There is no type field to drift from the folder.
  • Internal links: relative links between .md files (../how-to/http-call.md). They work on the SDK's GitHub view, and the fetch step rewrites them to site routes.
  • Images: only under docs/assets/, referenced by relative path.
  • Format: plain Markdown (.md). MDX is out of scope at first, so SDKs are not coupled to website components.
  • Validation in the SDK: a reusable workflow, published by the website repository, checks frontmatter, folder structure and broken links on every PR that touches docs/.

Publishing pipeline

A tagged SDK release is the only path to the website; validation runs earlier, in the SDK's own PRs.

flowchart LR
    subgraph sdk["SDK repository · sdk-java, sdk-go, …"]
        pr["PR edits docs/"] --> validate["Validate docs<br/>(reusable workflow)"]
        validate -- contract fails --> pr
        validate --> merge["Merge to main"] --> release["Release tag<br/>(the pinned ref)"]
    end
    subgraph web["Website repository · serverlessworkflow.github.io"]
        trigger["Rebuild trigger<br/>(hook or dispatch)"] --> fetch["Fetch docs/<br/>at release tags"] --> build["Astro build<br/>(schema check)"] --> deploy["Deploy<br/>(Netlify)"]
    end
    release -- triggers rebuild --> trigger
Loading
  • Fetch: scripts/fetch-sdk-docs.mjs reads a manifest (sdks.json: repo, tag, target folder), downloads each repo's docs/ at that tag (tarball or sparse checkout) and rewrites internal links to site routes. It runs as prebuild, so Netlify runs it too.
  • Triggers: an SDK release calls the Netlify build hook or sends a repository_dispatch to the website repo. A nightly scheduled build is a safety net.
  • Ref bump: the release workflow opens a PR on the website updating the tag in sdks.json, so the version shown on the site is reviewed and in git history.
  • Local development: npm run dev runs the fetch first; SDK_DOCS_PATH=../sdk-java/docs points at a local checkout instead, for writing docs with live preview.

Alternatives considered

Alternative Why not
Docs centralized in the website repository Docs change in a separate PR, reviewed by other people, and drift behind the API.
Git submodules for each SDK in the website Updates need a website commit, clones get heavier and contributors forget --recursive. A fetch script does the same without that friction.
A separate site per SDK (e.g. each repo's GitHub Pages) Fragmented navigation, search and look. Users lose a single view of the Serverless Workflow project.
Fetch from SDK main instead of a tag The site would document unreleased features, and a broken merge in an SDK would break the website build.
Dapr-style tabbed pages with every language's code in one central file Unified look, but SDK code lives outside the SDK and goes stale. Fragments per SDK keep the same tabs while the code stays with its owners.

Contributor guide

The website ships a contributor guide at /docs/contributing/docs, modeled on Dapr's docs contributor guide and adapted to this model. Every SDK's CONTRIBUTING.md links to it. Its first job is telling a contributor where a change goes.

flowchart LR
    start["New content<br/>what does it do?"]
    start -- teaches or solves a task --> unified["Shared page + SDK fragments<br/>concepts: website · code: each SDK"]
    start -- explains a spec concept --> explanation["Explanation page · website<br/>spec concepts, no tabs"]
    start -- lists SDK-specific facts --> reference["Reference page · that SDK<br/>APIs, configuration, modules"]
Loading
Guide section What it tells the contributor
Where does my page go? The decision above, with one real example per path.
Templates A starter file per kind: shared tutorial page, shared how-to page, SDK fragment, reference page, explanation page. Copy, rename, fill in.
Frontmatter Required fields, order for sidebar position, slug = file name and unique within its type.
Writing fragments Step headings must match the shared page's slots. Pull code from tested examples with snippet markers. One fragment per SDK per page.
Style and tone Second person ("you"), present tense, sentence-case headings, short sentences. Assume a developer new to Serverless Workflow.
Links and images Relative .md links; images in docs/assets/, named after the page, always with alt text.
Previewing locally Clone the website and run SDK_DOCS_PATH=../sdk-java/docs npm run dev; check light and dark themes.
Opening the PR Which repository gets the PR. A new unified page lands on the website first, then one fragment PR per SDK. What the validation workflow checks.
When it goes live SDK fragments and reference pages publish with the next SDK release tag; website-only pages publish on merge.

Two Dapr sections are left out: branch-per-release (pinned tags already cover versions) and translations (out of scope for now).

Consequences

Positive

  • An API change and its docs land in the same PR, reviewed by the SDK maintainers.
  • The site shows docs for released versions only, and the pinned ref opens the door to versioned docs later.
  • Every SDK shares one layout and one Diátaxis structure, so readers know where to look in any language.

Negative

  • The website build depends on fetching several repositories; a GitHub outage or a bad tag fails the build.
  • Local development needs the fetch step (or a fallback) before npm run dev shows SDK pages.
  • A schema change on the website is a breaking change for every SDK and needs coordination.

Migration plan (Java first)

  1. Website PR: add the docs collection, the docs layout and routes, and a sidebar grouped by Diátaxis type; add the fetch script, the sdks.json manifest, the reusable validation workflow and the contributor guide.
  2. sdk-java PR: add docs/ with tutorials/getting-started.md and the validation workflow; trigger the website rebuild on release.
  3. Repeat step 2 for sdk-go and the other SDKs.

Activity

  1. mathecruz commented on Nov 24, 2026

    @mathecruz
    ContributorAuthor
  2. ricardozanini commented on Nov 25, 2026

    @ricardozanini
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions