Skip to main content

View and host API documentation

The generated API documentation can be hosted by liblab, or you can download it to view locally and host on a web server.

liblab hosted documentation

The easiest way to host your documentation is to use liblab. Documentation is automatically published to liblab as a part of your build once you approve the documentation.

Approve SDK documentation for publishing using the liblab CLI

Once you are happy with the documentation, you can approve it to have it published and hosted by liblab. This can be done interactively when running liblab build:

✓ Doc built
SDKs downloaded successfully. You can find them inside the "output" folder
Action Link
──────── ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
Preview https://docs.liblab.com/liblab/preview/1ebe91ad-e08e-40ea-b05c-1808bc2dfcd3
Download https://prod-liblab-api-stack-docs.s3.us-east-1.amazonaws.com/1ebe91ad-e08e-40ea-b05c-1808bc2dfcd3/bundle.zip
? Would you like to approve and publish these docs now? (Y/n)

Select Y to approve the docs, and they will be published and hosted by liblab.

? Would you like to approve and publish these docs now? Yes
The docs have been published: view them at https://docs.liblab.com/liblab/exciting.soda/0.1.0

You can also auto approve the docs during the build process by passing the --approve-docs flag to the liblab build command.

liblab build --approve-docs

This is useful during an automated build, such as in a CI/CD pipeline.

Approve or unapprove documentation using the liblab portal

Documentation can be approved and published, or unapproved to remove the published docs using the liblab portal against the SDK build. You can read more about this in the portal documentation

Accessing hosted documentation

Once docs are approved you can find them in the liblab portal against the SDK build. You can read more about this in the portal documentation

View documentation locally

When you generate your SDK documentation using the liblab CLI, you will have an option to download the documentation bundle. This bundle contains the generated documentation as a Next.js app, which can be viewed locally in your browser.

You can also download the documentation bundle from the liblab portal.

This documentation can be run in one of 2 ways:

  • Using a web server. From the root of the documentation bundle, run the following command to start a web server and view the documentation in your browser:

    npx serve

    The console output will show where the documentation is being served. By default, it will be at http://localhost:3000, but another port may be picked if 3000 is in use.

  • Open the index.html file in your browser. By default the documentation website has CORS enabled, so you will need to allow file access when running your browser first.

    • For examnple, if you use Chrome, you can pass --allow-file-access-from-files to the Chrome executable to allow file access. For example, on macOS run:

      /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-files

      On Windows run:

      chrome.exe --allow-file-access-from-files`

    Once your browser is running, open the index.html file from the downloaded docs.