10 · Docs / OpenAPI
Interactive Swagger UI docs
swaggerUI({ url }) returns a complete HTML page wired to the Swagger UI CDN — drop in one route.
Code
swagger-ui.js
const { WebApp, swaggerUI } = require(class="tk-str">39;@hyperbridge/forge/server39;); const app = new WebApp(); app.get(class="tk-str">39;/docs39;, (c) => c.html( swaggerUI({ url: class="tk-str">39;/openapi.json39; }) )); class="tk-cm">// ... openapi.json endpoint ... app.listen(3000);
How it works
The returned HTML pulls Swagger UI's CSS and JS from a CDN, configured against your spec URL. No npm install, no build step.
Theme, title, layout are all options on swaggerUI() — see the type definitions for the full surface.
For air-gapped deployments, vendor the Swagger UI assets and pass { swaggerUrl: '/static/swagger-ui.css' }.
Try it
Quickstart
open http://localhost:3000/docs
Related modules
This is HBForge's port of Hono's example. Read the original at hono.dev/examples/swagger-ui.