swagger-ui-react

A React component that turns OpenAPI/Swagger specs into interactive, browsable API documentation.

Library
npm
v5.33.0
29,026 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
97 /100 Excellent
Development Activity 96
Maintenance 96
Community 96
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
80 /100 Excellent
Architecture 80
Code Quality 88
Innovation 75
Learning Curve 75

swagger-ui-react is the React-flavored distribution of Swagger UI, the reference renderer for OpenAPI (formerly Swagger) specifications. Instead of exposing the vanilla-JS constructor function that the core swagger-ui package ships, this flavor exports a drop-in <SwaggerUI /> component so React applications can embed interactive API documentation without manually bootstrapping the underlying system.

Under the hood it wires up the same Redux-backed core used by the standalone Swagger UI distribution — parsing an OpenAPI document (from a spec object/string or a remote url), rendering operations, models, and “Try it out” request forms, and letting consumers hook in request/response interceptors, custom plugins, and layout overrides. Versions track the core swagger-ui package one-to-one, so a given release always renders the same UI as the equivalent core version.

What You Get

  • A <SwaggerUI /> component you can mount anywhere in a React tree, initialized from a spec object/string or a remote url
  • The full Swagger UI rendering engine (operations, models, “Try it out” execution) reused from the core swagger-ui package via a shared Redux-backed system
  • Configurable request/response interceptors, custom plugins, and presets for tailoring parsing and display behavior
  • Peer-dependency packaging (react/react-dom as peerDependencies rather than bundled deps) so the component matches your app’s existing React version
  • A companion swagger-ui.css stylesheet exported alongside the component for styling

Common Use Cases

  • Embedding live, browsable REST API reference docs inside an internal developer portal built in React
  • Letting API consumers execute real “Try it out” requests against a documented endpoint from within a product’s own UI
  • Shipping OpenAPI documentation as part of a SaaS product’s public developer docs page
  • Prototyping and reviewing an OpenAPI spec during API design by rendering it live in a React admin tool

Under The Hood

Architecture The flavor itself is a thin ~180-line wrapper (flavors/swagger-ui-react/index.jsx) around the core rendering engine: it builds a SwaggerUIConstructor system instance in a useEffect, stores it in component state, and renders whatever root component the system’s plugin registry (getComponent("App", "root")) resolves to. All real logic — parsing specs, managing operations/models, driving “Try it out” requests — lives in the shared src/core tree (plugins/, presets/, containers/, components/, system.js), organized as a Redux-backed plugin system where each concern (auth, deep linking, request snippets, etc.) is its own plugin composed at startup. The React flavor’s only real coupling point is the #swagger-ui import alias, swapped per-build to point at different core bundles.

Tech Stack Core state management runs on redux/react-redux with reselect selectors and immutable for state shape, layered under a plain-JS/JSX component tree (411 .js/.jsx files vs. only 2 .ts files — TypeScript is used for declaration emission only, with checkJs/strict both off). The React flavor declares react/react-dom as peerDependencies (>=16.8.0 <20) while the core package depends on swagger-client for spec resolution, js-yaml for YAML parsing, and dompurify for sanitizing rendered content. Five separate Webpack configs (webpack/core.js, bundle.js, standalone.js, es-bundle.js, es-bundle-core.js) produce the different distribution flavors, including this one.

Code Quality The monorepo has an extensive unit-test suite (82 files under test/unit) built on Jest, Enzyme, and react-test-renderer, plus a full Cypress end-to-end suite (test/e2e-cypress) run in CI via GitHub Actions (nodejs.yml, codeql.yml, security-scan.yml). Linting is enforced with ESLint (typescript-eslint + eslint-plugin-react) and Prettier, styles with Stylelint, and Husky/lint-staged/commitlint gate commits — a comprehensive setup for a JS/JSX-heavy codebase with type safety, thorough testing, and CI all present.

API Design The public surface is a single component with prop defaults pulled from a shared config.defaults object, keeping the getting-started path to a two-line import plus one JSX element. The README is explicit about limitations (several props only apply on mount, OAuth redirect handling and topbar mode aren’t supported), which is unusually honest developer-experience documentation rather than glossing over rough edges — a reasonable trade for reusing one core rendering engine across three different packaging flavors.

Used by 12 apps in this directory

Python
89%
Apache 2.0

Apache Airflow

Data Engineering

46,995

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 89%
Updated 5 days ago
Java
48%
Apache 2.0

ClearFlask

Community · Product Management

451

Open-source feedback management and roadmap tool that lets product teams collect, prioritize, and respond to user input — with AI-powered summarization and full self-hosting control.

View details
83
Repo Health
73
Technical
62
Dependency
Built with
Java 48%
TypeScript 47%
Updated 1 weeks ago
TypeScript
93%
AGPL 3.0

CourseLit

Blogging · Ecommerce

1,268

Open-source, self-hosted LMS for selling online courses, digital downloads, and building communities on your own branded website.

View details
77
Repo Health
74
Technical
68
Dependency
Built with
TypeScript 93%
Updated 6 days ago
TypeScript
98%
Other

Dokploy

Devops · Hosting Control Panel · Security

37,543

Self-hosted PaaS that deploys apps and databases on your own VPS using Docker, Traefik, and multi-build-system orchestration

View details
88
Repo Health
76
Technical
64
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
Go
83%
MIT

Gitea

Developer Tools · Devops · Project Management

58,194

Self-hosted DevOps in a single Go binary — Git hosting, GitHub Actions-compatible CI/CD, and 30+ package registries without any SaaS dependency.

View details
93
Repo Health
79
Technical
64
Dependency
Built with
Go 83%
Updated 5 days ago
Ruby
67%
Other

GitLab

Developer Tools · Devops

24,552

The complete DevOps platform that unifies Git hosting, CI/CD, issue tracking, and security scanning into a single self-hostable application.

View details
87
Repo Health
86
Technical
67
Dependency
Built with
Ruby 67%
JavaScript 20%
Updated 5 days ago
TypeScript
48%
AGPL 3.0

Grafana

Analytics · Monitoring

76,962

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
63
Dependency
Built with
TypeScript 48%
Go 46%
Updated 5 days ago
TypeScript
83%
Apache 2.0

Grist

Databases · No Code Platforms

11,875

A modern relational spreadsheet that combines Python-powered formulas, drag-and-drop dashboards, and granular access controls in a self-hostable, SQLite-backed data platform.

View details
91
Repo Health
93
Technical
66
Dependency
Built with
TypeScript 83%
Python 11%
Updated 6 days ago
Go
86%
MIT

Hatchet

AI Development · Automation · Developer Tools

8,014

A Postgres-backed orchestration engine for background tasks, AI agents, and durable workflows that replaces Redis queues and multi-datastore durable execution platforms with a single self-hostable service.

View details
88
Repo Health
83
Technical
67
Dependency
Built with
Go 86%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers