Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of Uvicorn?

I supposed to work with FastAPI. I was taught that FastAPI is used with Uvicorn. What exactly is Uvicorn. I don't know what uvicorn is doing with FastAPI exactly. Can anyone explain?

like image 577
Rohit Prabu Avatar asked Sep 02 '25 04:09

Rohit Prabu


1 Answers

uvicorn is an ASGI (async server gateway interface) compatible web server. It's (simplified) the binding element that handles the web connections from the browser or api client and then allows FastAPI to serve the actual request.

uvicorn listens on a socket, receives the connection, does a bit processing and hands the request over to FastAPI, according to the ASGI interface.

You can read more about what the ASGI specification is, why ASGI was needed and other ASGI implementations on Uvicorn's homepage.

like image 57
MatsLindh Avatar answered Sep 05 '25 00:09

MatsLindh