Skip to content

Showcasing APIs with Starlight OpenAPI

For REST APIs, an OpenAPI (Swagger) specification is the gold standard. starlight-openapi allows you to render these specifications directly within your Starlight documentation site.

  • Schema Rendering: Beautifully formatted API endpoints and models.
  • Sidebar Integration: Adds API categories to your navigation.
  • Multiple Schemas: Support for documenting multiple APIs.
  1. Have your openapi.json or openapi.yaml ready.
  2. Install the plugin:
Terminal window
npm install starlight-openapi
  1. Configure it:
import starlightOpenAPI from 'starlight-openapi';
// ...
plugins: [
starlightOpenAPI([
{
base: 'api',
label: 'My API',
schema: './src/openapi.yaml',
},
]),
],

Your API documentation will now be accessible under /api!