Skip to content

Documentation Sites

@rapidoc/starlight adds an API reference page per OpenAPI document to a Starlight site. The page uses Starlight’s layout and themes, and the API’s operations appear in Starlight’s sidebar.

npm install @rapidoc/starlight
astro.config.mjs
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import starlightRapidoc from '@rapidoc/starlight';
export default defineConfig({
integrations: [
starlight({
title: 'My docs',
plugins: [starlightRapidoc({ uiPath: '/api', spec: './openapi.yaml' })],
}),
],
});

spec is a file, a URL or an object, read when the site is built. For several APIs pass { apis: [...] }.

VitePress has no plugin system, so there are two steps: wrap the config, and put the component on a page.

.vitepress/config.mjs
import { defineConfig } from 'vitepress';
import { withRapidoc, rapidocSidebar } from '@rapidoc/vitepress';
export default withRapidoc(
defineConfig({
themeConfig: {
sidebar: [{ text: 'Pets API', items: await rapidocSidebar({ spec: './openapi.yaml', uiPath: '/api' }) }],
},
}),
{ apis: { pets: './openapi.yaml' } },
);
api.md
---
layout: page
---
<script setup>
import { RapidocReference } from '@rapidoc/vitepress/client';
</script>
<RapidocReference api="pets" />

Three steps: the plugin, a doc page, and the sidebar.

docusaurus.config.js
export default {
plugins: [['@rapidoc/docusaurus', { apis: { pets: './openapi.yaml' } }]],
};
docs/api.mdx
---
hide_table_of_contents: true
---
import RapidocReference from '@rapidoc/docusaurus/client';
<RapidocReference api="pets" />
sidebars.js
import { rapidocSidebarSync } from '@rapidoc/docusaurus';
export default {
docs: [
{
type: 'category',
label: 'Pets API',
items: rapidocSidebarSync({ spec: './openapi.yaml', uiPath: '/docs/api', docId: 'api' }),
},
],
};

For another framework or site generator, see Build an Integration.