This project demonstrates a clean implementation of API Versioning in ASP.NET Core (.NET 9) using URL-based versioning along with a modern API testing interface powered by Scalar UI.
- ✅ RESTful CRUD API for managing Students
- ✅ API Versioning (V1 & V2) using URL segments
- ✅ Separate DTOs for each version
- ✅ Backward compatibility support
- ✅ Clean architecture with Service layer
- ✅ Scalar UI for interactive API testing
- ✅ Lightweight in-memory data storage
- .NET 9 / ASP.NET Core Web API
- API Versioning (Asp.Versioning)
- Scalar UI (OpenAPI-based API client)
- C#
Controllers/
├── V1/
│ └── StudentsV1Controller.cs
├── V2/
│ └── StudentsV2Controller.cs
Entities/
├── DTOs/
│ ├── V1/
│ └── V2/
└── Models/
Services/
├── IStudentService.cs
└── StudentService.cs
This project uses URL-based versioning:
/api/v1/students
/api/v2/students
{
"id": 1,
"name": "John Doe"
}{
"id": 1,
"firstName": "John",
"lastName": "Doe"
}Scalar provides a modern interface to test APIs.
Access it at:
https://localhost:{port}/scalar
- Clone the repository
- Run the project
- Open Scalar UI
- Test endpoints with version values
- How to implement API versioning in real-world applications
- Importance of DTO separation for backward compatibility
- Clean service-based architecture
- Using modern API clients like Scalar instead of Swagger
- Integration with Entity Framework Core
- Database support (SQL Server)
- Authentication & Authorization (JWT)
- AutoMapper for DTO mapping
- Versioning via headers/query params
Feel free to fork and enhance this project 🚀