Hacker News new | ask | show | jobs
by fastball 1659 days ago
I used to really like Flask but after trying FastAPI I doubt I'd ever go back. I even rewrote the entire backend for our product in FastAPI and unlike some rewrites I've done in the past am 100% happy with this one. Major benefits for us:

- Faster in general than Flask (thanks to starlette / uvicorn)

- asyncio libs in Python are generally beating out others in terms of perf (e.g. asyncpg vs psycopg2). This isn't to start a whole "asyncio is faster" flamewar, not saying that's necessarily true. Just that it seems the people who are building in asyncio are also people who care about perf, which I do as well. The (non-asyncio) Python community has neglected perf for a bit too long imo.

- asynchronous style works much better with things like WebSockets, which we use

- Auto-generating an OpenAPI schema[1] is nice to have.

- Using type hints for things simultaneously encourages mildly "safer" code while also giving better auto-complete suggestions

[1] https://api.supernotes.app/docs/swagger