fastapi VS Flask

Compare fastapi vs Flask and see what are their differences.

Our great sponsors
  • SonarLint - Deliver Cleaner and Safer Code - Right in Your IDE of Choice!
  • OPS - Build and Run Open Source Unikernels
  • Scout APM - Less time debugging, more time building
fastapi Flask
185 43
40,608 57,600
- 0.6%
9.6 9.2
2 days ago 7 days ago
Python Python
MIT License BSD 3-clause "New" or "Revised" License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

fastapi

Posts with mentions or reviews of fastapi. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-01-16.
  • How to Build a Machine Learning Demo in 2022
    7 projects | dev.to | 16 Jan 2022
    The goal of the back end is to act as a wrapper for a model so that it can be queried via HTTP requests from the front end, something referred to as model serving. In order to do so, one would typically use a web framework. For a long time, Flask was the standard for Python-based web frameworks, and is indeed still very popular. However, FastaAPI is quickly becoming the new favorite, thanks to impressive performance and native support for asynchronous operations. This article is a good starting point to understand how a simple model can be deployed using FastAPI, while this tutorial provides a complete overview of all the steps required to serve a PyTorch model with GPU support.
  • Generate customizable FastAPI projects for high-performance applications. Based on MVC, WSGI + ASGI with tests, pipeline, utilities, helm, and more.
    6 projects | reddit.com/r/Python | 13 Jan 2022
    As of today, FastAPI doesn't have any project generator like other known web frameworks ex: Django, Rails, etc., which makes creating new projects based on it that much more time-consuming. The idea behind this package is that one can generate a new project with one command and then start implementing endpoints logic straightaway, rather than creating the whole project from scratch. Moreover, the project is structured in MVC architectural pattern to help developers who don't know FastAPI yet but are familiar with MVC to get up to speed quickly.
  • AtlasHackathon - A Quiz API using MongoDB and FastAPI
    2 projects | dev.to | 12 Jan 2022
    FastApi
  • New package: Django REST - Typed
    3 projects | reddit.com/r/django | 10 Jan 2022
    I've borrowed ideas from FastAPI.
  • Intro to Asynchronous Python with Asyncio
    3 projects | dev.to | 10 Jan 2022
    While humans are notoriously awful at multitasking, machines can see significant performance benefits from this practice, as they are generally better suited to start and stop work without the extraneous overhead. This concept is the "secret sauce" of frameworks such as FastAPI, an asynchronous Python framework that self-proclaims performance to be "on par with NodeJS and Go" (I promise to write a fair share on FastAPI another time).
  • Starlite: the little API framework that can
    8 projects | reddit.com/r/Python | 10 Jan 2022
    From https://fastapi.tiangolo.com/
    8 projects | reddit.com/r/Python | 10 Jan 2022
    Interesting thread on FastAPId claim for being fast: https://github.com/tiangolo/fastapi/issues/1664
  • A rare event that makes us all happy
    2 projects | reddit.com/r/ProgrammerHumor | 9 Jan 2022
    I loved FastAPI in Python. Excellent documentation. It even goes into details of things that are typically assumed to be known (e.g. Python types, concurrency, etc.). It also provides helpful links to understand the basics of web frameworks.
  • Ask HN: Ethical ads providers to monetize personal blog
    1 project | news.ycombinator.com | 8 Jan 2022
    I've just started my personal blog (link in bio), never done this before, but I'm looking forward to eventually get some money from my blogging activities. My first idea was to serve some ethical ads - I don't want anything that tracks the visitors, obviously. Something like a sponsorship banner, or, maybe, a precisely targeted context ad with the exact hit to the tune of my blog.

    I'm talking about something like the banners in the header of FastAPI website[1], look pretty neat. Is it just cold emailing for those, who use the said framework, or are there providers of such sponsored banners?

    Where should I look for the advertisers providing ethical ads? Which companies have you dealt with? I'm aware of EthicalAds.io, but it looks like I'd have to be an established publisher to qualify.

    Maybe, you'll advise against serving such ads and share your experience of utilizing some other type of blog monetization?

    Thanks in advance!

    [1] https://fastapi.tiangolo.com/

  • Billie | The Most Best Way to Create a Professional Invoice
    5 projects | dev.to | 8 Jan 2022
    FastApi - FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

Flask

Posts with mentions or reviews of Flask. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-01-16.
  • How to Build a Machine Learning Demo in 2022
    7 projects | dev.to | 16 Jan 2022
    The goal of the back end is to act as a wrapper for a model so that it can be queried via HTTP requests from the front end, something referred to as model serving. In order to do so, one would typically use a web framework. For a long time, Flask was the standard for Python-based web frameworks, and is indeed still very popular. However, FastaAPI is quickly becoming the new favorite, thanks to impressive performance and native support for asynchronous operations. This article is a good starting point to understand how a simple model can be deployed using FastAPI, while this tutorial provides a complete overview of all the steps required to serve a PyTorch model with GPU support.
  • Folder structure
    1 project | reddit.com/r/flask | 7 Jan 2022
    Not sure if it's what you're looking for but I typically use the tutorial or the tutorial github. This is really just a templates and static folder with the blueprints in the main dir though.
  • Perfect and standard full website download
    1 project | reddit.com/r/learnpython | 31 Dec 2021
    You can then make inside the docs directory to build them locally: https://github.com/pallets/flask/tree/main/docs
  • how to keep order of sorted dictionary passed to jsonify() function?
    1 project | reddit.com/r/codehunter | 16 Dec 2021
    from collections import OrderedDict>>>>>> json_data = {... "11": {... "j_id": "out",... },... "aa": {... "j_id": "in",... },... "bb": {... "j_id": "out",... },... }>>>>>> jkeys=json_data.keys()>>> sorted_json = sorted(jkeys, key=lambda x: json_data[x]['j_id'], reverse=False)>>>>>> new_sorted=OrderedDict()>>> for rec in sorted_json:... new_sorted[rec]=json_data[rec]...>>> print('sort dict: {}'.format(new_sorted))sort dict: OrderedDict([('aa', {'j_id': 'in'}), ('11', {'j_id': 'out'}), ('bb', {'j_id': 'out'})]) ``` Unfortunately, when I pass this to jsonify() function and then for example console.log() output of flask data, the orderd becomes like that: 11, aa, bb. Additionally to that, I've done some research and found this stackoverflow answer, leading to some good documentation notes which clearly states that setting JSON_SORT_KEYS to False is not recommended way. Then I checked this github issue and it seems that problem is not fully resolved in flask.
  • Generic question: how does flask work exactly?
    1 project | reddit.com/r/flask | 29 Nov 2021
  • Ask HN: Simplest stack to build web apps in 2021?
    17 projects | news.ycombinator.com | 22 Nov 2021
  • How to deploy your Python Flask projects
    2 projects | dev.to | 16 Nov 2021
    Flask is a straightforward framework for Python web development that makes it easy to get started on your web applications.
  • Getting started with Flask and Cerberus - Building a Chess Analysis App (Part 2)
    1 project | dev.to | 16 Nov 2021
    We're using Flask as our web server because it is very lightweight, so we'll want to install that next.
  • Can I use google cloud for free for non commercial purpose?
    3 projects | reddit.com/r/googlecloud | 14 Nov 2021
    If your app is really small/short, you're only fetching crime data and rendering a static image, you can probably do it all with a Cloud Function. This way you don't even need to have nor learn about nor use full web frameworks like Flask, Django, Pyramid, etc. Just raw code plus an HTML template and perhaps a tiny bit of Flask/Jinja2 to render the template.
  • Most Popular Backend Frameworks of 2021
    10 projects | dev.to | 10 Oct 2021
    GitHub stars: 54708 (github.com)

What are some alternatives?

When comparing fastapi and Flask you can also consider the following projects:

AIOHTTP - Asynchronous HTTP client/server framework for asyncio and Python

Tornado - Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.

Django - The Web framework for perfectionists with deadlines.

vibora - Fast, asynchronous and elegant Python web framework.

HS-Sanic - Async Python 3.6+ web server/framework | Build fast. Run fast. [Moved to: https://github.com/sanic-org/sanic]

quart - Official mirror of https://gitlab.com/pgjones/quart

starsessions - Pluggable sessions support for Starlette and FastAPI.

CherryPy - CherryPy is a pythonic, object-oriented HTTP framework. https://cherrypy.dev

Bottle - bottle.py is a fast and simple micro-framework for python web-applications.

web.py - web.py is a web framework for python that is as simple as it is powerful.