With .NET 9, ASP.NET Core has charted a bold new course: built-in OpenAPI generation is now nativeâââno more Swashbuckle/Swagger by default. But while the auto-generated JSON spec is great, what about a developer-friendly documentation UI?
Enter Scalarâââa sleek, lightweight, and powerful alternative to Swagger UI. Letâs explore how .NET 9 and Scalar together offer a modern, efficient, and maintainable API documentation experience.
đ What Changed in .NET 9?#
Until .NET 9, the default WebAPI templates included Swagger UI (via Swashbuckle). But thatâs no longer the case. The .NET team deprecated built-in Swagger integration:
- Swashbuckle isnât maintained: It hasnât officially supported .NET 8 and is seen as outdated
- Built-in OpenAPI support replaces it: You can generate your API spec out of the box using:
| |
That gives you a valid openapi/v1.json, but no visual interface.
đ§ Why Scalar Beats Swagger UI#
Scalar steps in exactly where Swagger UI left off, offering several clear advantages:
- Faster & lighter UIâââIdeal for large APIs, especially compared to Swagger UIâs sluggishness
- Cleaner, modern interfaceâââBuilt-in dark mode, nice visuals, better usability
- Interactive featuresâââLive request testing, authentication support, code snippets, and search
- Simple setup + no lock-inâââJust install
Scalar.AspNetCoreand callapp.MapScalarApiReference() - Auto-generated client codeâââInstantly get C#, Java, and more API clients
Summary:
- Speed for large APIs
- UX that feels modern
- Features like code examples and auth built-in
- Ease of configuration with no extra hassle
âïž Setup: .NET 9 + Scalar in Minutes#
Install NuGet:
| |
Configure in **Program.cs**:
| |
Browse to https://localhost:<port>/scalar/v1 and enjoy your new interactive API docs.

Want to customize auth, themes, or endpoints? Scalar supports it all via fluent options.
đ§ When to Use Scalar#
- You like Swagger generation but not the clunky UI
- You need fast, responsive docs, especially for large APIs
- You want built-in live testing, search, code samples, and authentication
And best of all? Scalar plays well with ASP.NET 9âs new OpenAPI setupâââno extra overhead.
đ Still Need Swagger?#
No problem! You can still install Swashbuckle.AspNetCore and use both. But consider this: maintaining Swagger may become a burdenâbecause itâs no longer part of the core .NET workflow. Scalar sticks to the modern, built-in path.
đ Final Thoughts#
.NET 9 simplifies API spec generation. With Scalar, you get a sleek, powerful UI thatâs easy to configure, lightweight, and packed with features.
Together, this combo is a clear upgrade over the old Swagger approachâââespecially for teams serious about developer experience.
You can find the demo code on my GitHub Profile.
