DEV Community

Cover image for JWT Authentication with FastAPI
Bek Brace
Bek Brace

Posted on

JWT Authentication with FastAPI

FastAPI : a great framework for creating APIs, it takes very small effort to realize how fast it is in comparison with other frameworks like Flask, Pyramid, bottle, tornado and Django.

Developers are switching from Flask to FastAPI for a lot of reasons like speed, for instance.

This is techempower.com, an independent website that benchmarks web servers by running a variety of tests on them, FastAPI (with Uvicorn, the ASGI server implementation) is one of the fastest web servers.
Image description
This is a performance comparison executing fundamental tasks such as JSON serialization, database access, and server-side template composition. Each framework is operating in a realistic production configuration.

And why I prefer FastAPI over others Fws is because of its high performance, ease of syntax, you have something like Pydantic that allows modern python typing, also asynchronous requests with Async/Await syntax .. and no wonder that FastAPI is on par with Go language and Node JS (which is built on the V8 engine, the same engine of Google Chrome)

Take a look at my latest video on the channel where you can learn how to build user authentication with web based tokens using JWTs ( pronounce Jots) or JSON Web Tokens; and how this is better than the traditional cookie based sessions

Thank you for reading ( and maybe watching :) )
I will see you in next Video posts, till then stay safe and be well, friends

Discussion (0)