(One of my summaries of the Pycon NL one-day conference in Utrecht, NL).
Full title: from flask to fastapi: why and how we made the switch.
He works at “polarsteps”, a travel app. Especially a travel app that will be used in areas with really bad internet connectivity. So performance is top of mind.
They used flask for a long time. Flask 2 added async, but it was still WSGI-bound. They really needed the async scaling possibility for their 4 million monthly users. Type hinting was also a big wish item for improved reliability.
They switched to fastapi:
True async support. It is ASGI-native
Typing and validation with pydantic. Pydantic validates requests and responses. Type hints help a lot.
Native auto-generated docs (openapi). Built-in swagger helps for the frontend team.
This meant they gave up some things that Flask provided:
Flask has a mature ecosystem. So they left a big community + handy heap of stackoverflow answers + lots of ready-made plugins behind.
Integrated command-line dev tools. Flask is handy there.
Simplicity, especially for new devs.
They did a gradual migration. So they needed to build a custom fastapi middleware that could support both worlds. And some api versioning to keep the two code bases apart. It took a lot of time to port everything over.
The middleware was key. Completely async in fastapi. Every request came through here. If needed, a request would be routed to Flask via wsgi, if possible it would go to the new fastapi part of the code.
For the migration, they made a dashboard of all the endpoints and the traffic volume. They migrated high-traffic APIs first: early infra validation. Attention to improvements by checking if the queries were faster. Lots of monitoring of both performance and errors.
Some lessons learned:
Async adds complexity, but pays off at scale. They started the process with 4 million users, now they’re at 20.
Pydantic typing catches errors early.
Versioned middleware made incremental delivery safe.
Data-driven prioritization (=the dashboard) beats a big-bang rewrite.
AI helps, but hallucinates too much on complex APIs.
Unrelated photo from our 2025 holiday in Austria: the beautiful ‘große Mühl’ river valley.
My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):