Swagger UI is from 2011. It’s Time to Upgrade to Scalar.

2026-11-18来源 dev.to TypeScriptEnglish

You've built a modern backend with TypeScript, NestJS, or Fastify. Clean architecture, type-safe APIs, and everything working perfectly.

Then someone opens your /docs endpoint.

And there it is. The same old Swagger UI.

Don't get me wrong. Swagger UI is great and has served developers for years. But API documentation can look and feel much better.

That's where Scalar comes in.

What Is Scalar?

Scalar is an open-source API documentation tool that gives your OpenAPI documentation a cleaner, more modern interface.

Think of it as Swagger UI, but with a better developer experience.

Here's what makes it interesting:

  • Modern UI: Clean layout, dark mode, and customizable themes.
  • Built-in API client: Test endpoints directly without switching to Postman.
  • Code snippets: Generate request examples in JavaScript, Python, Go, and more.
  • Authentication: Support for Bearer tokens, API keys, and other OpenAPI security schemes.
  • OpenAPI support: Works with your existing OpenAPI specifications.

And the best part?

You don't need to change your backend or rewrite your API schemas.

Swagger UI vs. Scalar

Here's a quick comparison:

Feature Swagger UI Scalar
UI Design Traditional accordion layout Modern, clean interface
Dark Mode Requires customization Built-in
API Testing Basic Try it out Integrated API client
Code Snippets Configurable request snippets Multiple languages and clients
Authentication Bearer, API keys, OAuth2 Bearer, API keys, OAuth2
Search Endpoint filtering Integrated reference search
Customization CSS and configuration Built-in themes and configuration
OpenAPI 3.1 Supported Supported
Open Source Yes Yes

Both tools do the job, but Scalar focuses more on the overall developer experience, especially when exploring and testing APIs.

How Easy Is It to Integrate?

If you're using Fastify with @fastify/swagger already configured, it's just a few lines.

Install Scalar:

npm install @scalar/fastify-api-reference 

Register it in your Fastify application:

await fastify.register( import('@scalar/fastify-api-reference'), { routePrefix: '/docs', configuration: { theme: 'purple', }, } ); 

Now open:

http://localhost:3000/docs

That's it. Your existing OpenAPI specification now has a modern documentation interface.

Scalar also supports NestJS, Express, Next.js, and other frameworks.

Should You Replace Swagger UI?

Not necessarily.

Swagger UI is still actively maintained and supports OpenAPI 3.1, authentication, and interactive requests.

Scalar simply offers a different, more polished experience for exploring and testing APIs.

If you're happy with Swagger UI, there's no reason to rush.

But if you want better-looking, developer-friendly API documentation without much effort, Scalar is definitely worth trying.

Final Thoughts

We spend hours improving our backend architecture, performance, and code quality.

Why not give the same attention to our API documentation?

A great API deserves a great developer experience.

Give Scalar a try on your next project.

What do you use for API documentation — Swagger UI, Scalar, or something else?

原文:https://www.a8q9.cn/en/article/swagger-ui-is-from-2011-it-s-time-to-upgrade-to-scalar-e5dd0f.html

相关文章