This is a minimized version of the Docusaurus OpenAPI Docs Template, built for Docusaurus 3. It has been stripped down to include only the essential components needed for API documentation.
- The Petstore API example with OpenAPI specification
All other components have been removed to create a minimal starting point for your API documentation.
# Clone this repository
git clone <your-repository-url>
cd <repository-name>
# Install dependencies
npm installnpm startThis command starts a local development server and opens up a browser window at http://localhost:3000. Most changes are reflected live without having to restart the server.
- API Documentation - See the Petstore API example at http://localhost:3000/docs/petstore/swagger-petstore-yaml
- Place your OpenAPI specification file in the
examples/directory - Update the
docusaurus.config.tsfile to include your API specification:
plugins: [
[
"docusaurus-plugin-openapi-docs",
{
id: "openapi",
docsPluginId: "classic",
config: {
yourapi: { // Change this to your API name
specPath: "examples/your-api-spec.yaml", // Path to your OpenAPI spec
outputDir: "docs/yourapi", // Output directory for generated docs
sidebarOptions: {
groupPathsBy: "tag",
categoryLinkSource: "tag",
},
},
},
},
],
]- Run
npm run gen-api-docsto generate the API documentation - Update the
sidebars.tsfile to include your API in the sidebar
npm run buildThis command generates static content into the build directory and can be served using any static contents hosting service.