Introduction
Scalar provides a polished developer experience for creating, testing, and documenting APIs. It reads your OpenAPI or Swagger spec and generates interactive, beautifully styled API reference pages that let consumers try endpoints directly in the browser.
What Scalar Does
- Generates interactive API reference documentation from OpenAPI 3.x and Swagger 2.0 specs
- Provides a modern REST API client for testing endpoints with authentication handling
- Offers embeddable components for React, Vue, Next.js, Nuxt, Express, Fastify, and more
- Supports dark mode, custom theming, and full CSS control over the generated pages
- Includes a CLI for serving, validating, and bundling OpenAPI documents
Architecture Overview
Scalar is built as a modular TypeScript monorepo. The core engine parses OpenAPI specs into an internal representation, then renders them through framework-specific adapters. The API client runs in-browser using fetch with proxy support for CORS-restricted endpoints. All rendering happens client-side, so the reference pages can be deployed as static assets or served from any backend.
Self-Hosting & Configuration
- Install the CLI globally via
npm install -g @scalar/clior usenpxfor one-off usage - Integrate into Express with
app.use('/docs', apiReference({ spec: { url: '/openapi.json' } }))middleware - Embed in React or Vue projects using
@scalar/api-reference-reactor@scalar/api-referencepackages - Configure authentication defaults, server URLs, and theme via a
scalar.config.jsonfile - Deploy generated static HTML to any CDN or serve dynamically from your backend
Key Features
- Zero-config rendering of OpenAPI specs into interactive documentation
- Built-in request builder with support for Bearer, API Key, OAuth 2.0, and Basic auth
- Framework integrations for all major Node.js and frontend frameworks
- Markdown support in descriptions with syntax highlighting for code samples
- MCP server support to expose OpenAPI documents to AI agents
Comparison with Similar Tools
- Swagger UI — the original OpenAPI renderer; Scalar offers a more modern UI and built-in API client
- Redoc — generates beautiful static docs but lacks an interactive request builder
- Stoplight Elements — similar feature set but Scalar is fully open source with no vendor lock-in
- RapiDoc — lightweight web component alternative; Scalar provides deeper framework integrations
- Mintlify — managed documentation platform; Scalar is self-hostable with no SaaS dependency
FAQ
Q: Does Scalar support OpenAPI 3.1? A: Yes. Scalar supports OpenAPI 3.0.x, 3.1.x, and Swagger 2.0 specifications out of the box.
Q: Can I customize the look and feel of the generated docs? A: Yes. Scalar supports custom CSS, theme presets, dark and light mode, and full layout control via configuration.
Q: Is the API client a standalone tool or part of the docs? A: Both. The client is embedded in the reference pages and also available as a standalone desktop and web application.
Q: How do I integrate Scalar with my CI/CD pipeline? A: Use the CLI to validate and bundle your spec in CI. You can also generate static HTML output for deployment to any hosting platform.