Prompt
How do I generate a developer portal from Swagger?
Latest observation
You can generate a developer portal from Swagger/OpenAPI in a few different ways, depending on how “portal-like” you want it to be.
1) Easiest: use an OpenAPI/Swagger docs portal product
If your goal is a public developer portal with docs, try tools that ingest Swagger/OpenAPI directly:
- Swagger UI — interactive API docs from an OpenAPI spec
- Redoc / Redocly — polished API reference docs
- Stoplight — docs + mocking + design
- ReadMe — full developer portal with auth, guides, changelog, API reference
- GitBook / Mintlify — docs sites with API reference support
Typical flow
- Export your Swagger spec as
openapi.yamloropenapi.json - Upload or point the portal tool to that file
- Customize branding, navigation, auth, and pages
- Publish
2) Self-hosted docs site from Swagger
If you want to build your own portal, use:
- Swagger UI for interactive reference
- ReDoc for clean reference pages
- A static site generator like Docusaurus, MkDocs, or Next.js for the rest of the portal
Example with Swagger UI
Host your spec and embed Swagger UI in your site:
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
<script>
SwaggerUIBundle({
url: "/openapi.yaml",
dom_id: "#swagger-ui"
});
</script>
This gives you an interactive API reference, but not a full portal by itself.
3) Generate code/docs from the Swagger file
If by “generate” you mean create a site or app from the spec, use generators:
- OpenAPI Generator — can generate client SDKs, server stubs, and docs
- Swagger Codegen — older but still used in some workflows
Example docs generation
With OpenAPI Generator:
openapi-generator-cli generate -i openapi.yaml -g html2 -o docs/
Or for a static API documentation site:
openapi-generator-cli generate -i openapi.yaml -g dynamic-html -o docs/
Recommended approach
For most teams:
- Simple API docs: Swagger UI or Redoc
- Full developer portal: ReadMe, Stoplight, or Docusaurus/Mintlify + OpenAPI reference
- Automated docs in CI: OpenAPI Generator + static hosting
Important note
“Swagger” usually refers to the OpenAPI specification. If you have a Swagger 2.0 file, many tools still support it, but some prefer OpenAPI 3.x. You may need to convert it first.
If you want, I can show you:
- how to turn a Swagger file into a static docs website,
- how to build a full developer portal, or
- the exact commands for your stack (React, Node, GitHub Pages, etc.).