Scripts2026年5月18日·1 分钟阅读

Scalar — Open-Source API Platform with Beautiful References

Scalar is an open-source API platform that provides a modern REST API client, beautiful auto-generated API references, and first-class OpenAPI and Swagger support for developer teams.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Scalar API Platform
通用 CLI 安装命令
npx tokrepo install acc51033-52b5-11f1-9bc6-00163e2b0d79

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/cli or use npx for 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-react or @scalar/api-reference packages
  • Configure authentication defaults, server URLs, and theme via a scalar.config.json file
  • 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.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产