When comparing ASP.NET Core vs FastAPI, the Slant community recommends ASP.NET Core for most people. In the question“What are the best web frameworks to create a web REST API?” ASP.NET Core is ranked 7th while FastAPI is ranked 15th.
Ranked in these QuestionsQuestion Ranking
Pro Fast and getting faster
Ability to host on IIS, Nginx, Apache, Docker, or self-host in your own process.
Pro Multi Platform
Can run on Windows, Linux and Mac (also Visual Studio Code editor).
Pro Built-in middleware
Pro Ease of Use
It is based on standards: OpenAPI, JSON Schema and OAuth 2.0
Pro Data validation
It validates the data using the types you declared. Even in deeply nested JSON requests.
Pro Dependency Injection
It has a simple but powerful dependency injection system, it can be used to handle authentication, per-user rate limiting, authorization controls (e.g. with roles), etc.
Pro Background tasks
Included support for background tasks, thanks to being based on Starlette
It's based on Starlette and Pydantic, so, it's one of the fastest Python frameworks.
Pro Editor completion
It is based on Python type declarations, so, editors and tools can give great support. Including type checks and autocompletion everywhere.
Pro Automatic docs
It generates interactive API documentation automatically from your code
Pro World class documentation
It has some of the best documentation of any framework
Because it's an async framework, it can handle async-native protocols like WebSockets
Pro Async IO / optional
It's based on Async IO, which gives it high concurrency. But you can use non-async libraries and it runs them appropriately.
Pro Database independent
It's independent of database or ORM, but compatible with all of them. Including relational databases and NoSQL.
Pro OAuth 2.0
It has integrated support for OAuth 2.0. Including declaring required scopes per endpoint. So, you can easily integrate it with external OAuth 2.0 providers or build your own with it.
Con Smaller community
Since FastAPI is relatively new, its community is smaller than Django Rest Framework.