@docutopia/fastify
v0.1.0
Published
Fastify plugin for Docutopia - A modern alternative to @fastify/swagger-ui
Maintainers
Readme
@docutopia/fastify
Fastify plugin for Docutopia - A modern alternative to @fastify/swagger-ui.
Features
- 🎨 Beautiful UI - Modern, interactive documentation interface
- 🔄 Interactive Testing - Test API endpoints directly in the browser
- 📋 Auto-generated - Automatically generated from your Fastify routes
- 🔐 Multiple Auth Methods - Bearer Token, API Key, and Basic Auth support
Installation
npm install @docutopia/fastifyQuick Start
import docutopia from '@docutopia/fastify';
import fastify from 'fastify';
const server = fastify();
// Register Docutopia plugin
await server.register(docutopia, {
routePrefix: '/docs',
swagger: {
openapi: {
info: {
title: 'My API',
description: 'API documentation',
version: '1.0.0',
},
},
},
});
await server.listen({ port: 3000 });Visit http://localhost:3000/docs to see your documentation.
Options
routePrefix (optional)
- Type:
string - Default:
"/documentation" - Description: URL prefix for the documentation routes
swagger (optional)
- Type:
SwaggerOptions - Description: Configuration for @fastify/swagger. If @fastify/swagger is not already registered, it will be registered automatically with this configuration.
await server.register(docutopia, {
routePrefix: '/docs',
swagger: {
openapi: {
info: {
title: 'My API',
version: '1.0.0',
},
},
},
});How It Works
The plugin automatically:
- Registers @fastify/swagger if not already registered
- Serves the Docutopia UI at the specified route prefix
- Exposes the OpenAPI spec at
{routePrefix}/json
License
MIT
