- FastAPI - Home
- FastAPI - Introduction
- FastAPI - Hello World
- FastAPI - OpenAPI
- FastAPI - Uvicorn
- FastAPI - Type Hints
- FastAPI - IDE Support
- FastAPI - Rest Architecture
- FastAPI - Path Parameters
- FastAPI - Query Parameters
- FastAPI - Parameter Validation
- FastAPI - Pydantic
- FastAPI - Request Body
- FastAPI - Templates
- FastAPI - Static Files
- FastAPI - HTML Form Templates
- FastAPI - Accessing Form Data
- FastAPI - Uploading Files
- FastAPI - Cookie Parameters
- FastAPI - Header Parameters
- FastAPI - Response Model
- FastAPI - Nested Models
- FastAPI - Dependencies
- FastAPI - CORS
- FastAPI - Crud Operations
- FastAPI - SQL Databases
- FastAPI - Using MongoDB
- FastAPI - Using GraphQL
- FastAPI - Websockets
- FastAPI - FastAPI Event Handlers
- FastAPI - Mounting A Sub-App
- FastAPI - Middleware
- FastAPI - Mounting Flast App
- FastAPI - Deployment
FastAPI Useful Resources
FastAPI - Introduction
FastAPI is a modern Python web framework, very efficient in building APIs. It is based on Pythons type hints feature that has been added since Python 3.6 onwards. It is one of the fastest web frameworks of Python.
As it works on the functionality of Starlette and Pydantic libraries, its performance is amongst the best and on par with that of NodeJS and Go.
In addition to offering high performance, FastAPI offers significant speed for development, reduces human-induced errors in the code, is easy to learn and is completely production-ready.
FastAPI is fully compatible with well-known standards of APIs, namely OpenAPI and JSON schema.
FastAPI has been developed by Sebastian Ramirez in Dec. 2018. FastAPI 0.127.0 is the currently available version.
FastAPI Environment Setup
To install FastAPI (preferably in a virtual environment), use pip3 installer.
pip3 install fastapi Collecting fastapi Downloading fastapi-0.127.0-py3-none-any.whl.metadata (30 kB) Collecting starlette<0.51.0,>=0.40.0 (from fastapi) Downloading starlette-0.50.0-py3-none-any.whl.metadata (6.3 kB) Collecting pydantic>=2.7.0 (from fastapi) Downloading pydantic-2.12.5-py3-none-any.whl.metadata (90 kB) Collecting typing-extensions>=4.8.0 (from fastapi) Downloading typing_extensions-4.15.0-py3-none-any.whl.metadata (3.3 kB) Collecting annotated-doc>=0.0.2 (from fastapi) Downloading annotated_doc-0.0.4-py3-none-any.whl.metadata (6.6 kB) Collecting anyio<5,>=3.6.2 (from starlette<0.51.0,>=0.40.0->fastapi) Downloading anyio-4.12.0-py3-none-any.whl.metadata (4.3 kB) Requirement already satisfied: idna>=2.8 in d:\projects\python\myenv\lib\site-packages (from anyio<5,>=3.6.2->starlette<0.51.0,>=0.40.0->fastapi) (3.11) Collecting annotated-types>=0.6.0 (from pydantic>=2.7.0->fastapi) Downloading annotated_types-0.7.0-py3-none-any.whl.metadata (15 kB) Collecting pydantic-core==2.41.5 (from pydantic>=2.7.0->fastapi) Downloading pydantic_core-2.41.5-cp314-cp314-win_amd64.whl.metadata (7.4 kB) Collecting typing-inspection>=0.4.2 (from pydantic>=2.7.0->fastapi) Downloading typing_inspection-0.4.2-py3-none-any.whl.metadata (2.6 kB) Downloading fastapi-0.127.0-py3-none-any.whl (112 kB) Downloading starlette-0.50.0-py3-none-any.whl (74 kB) Downloading anyio-4.12.0-py3-none-any.whl (113 kB) Downloading annotated_doc-0.0.4-py3-none-any.whl (5.3 kB) Downloading pydantic-2.12.5-py3-none-any.whl (463 kB) Downloading pydantic_core-2.41.5-cp314-cp314-win_amd64.whl (2.0 MB) ââââââââââââââââââââââââââââââââââââââââ 2.0/2.0 MB 6.1 MB/s 0:00:00 Downloading annotated_types-0.7.0-py3-none-any.whl (13 kB) Downloading typing_extensions-4.15.0-py3-none-any.whl (44 kB) Downloading typing_inspection-0.4.2-py3-none-any.whl (14 kB) Installing collected packages: typing-extensions, anyio, annotated-types, annotated-doc, typing-inspection, starlette, pydantic-core, pydantic, fastapi Successfully installed annotated-doc-0.0.4 annotated-types-0.7.0 anyio-4.12.0 fastapi-0.127.0 pydantic-2.12.5 pydantic-core-2.41.5 starlette-0.50.0 typing-extensions-4.15.0 typing-inspection-0.4.2
FastAPI depends on Starlette and Pydantic libraries, hence they also get installed.
Installing Uvicorn using PIP
FastAPI doesnt come with any built-in server application. To run FastAPI app, you need an ASGI server called uvicorn, so install the same too, using pip3 installer. It will also install uvicorns dependencies - asgiref, click, h11, and typing-extensions
pip3 install uvicorn Collecting uvicorn Downloading uvicorn-0.40.0-py3-none-any.whl.metadata (6.7 kB) Collecting click>=7.0 (from uvicorn) Downloading click-8.3.1-py3-none-any.whl.metadata (2.6 kB) Collecting h11>=0.8 (from uvicorn) Downloading h11-0.16.0-py3-none-any.whl.metadata (8.3 kB) Collecting colorama (from click>=7.0->uvicorn) Downloading colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB) Downloading uvicorn-0.40.0-py3-none-any.whl (68 kB) Downloading click-8.3.1-py3-none-any.whl (108 kB) Downloading h11-0.16.0-py3-none-any.whl (37 kB) Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB) Installing collected packages: h11, colorama, click, uvicorn Successfully installed click-8.3.1 colorama-0.4.6 h11-0.16.0 uvicorn-0.40.0
With these two libraries installed, we can check all the libraries installed so far.
pip3 freeze annotated-doc==0.0.4 annotated-types==0.7.0 anyio==4.12.0 asgiref==3.11.0 certifi==2025.11.12 cffi==2.0.0 charset-normalizer==3.4.4 click==8.3.1 colorama==0.4.6 crypto==1.4.1 cryptography==46.0.3 Django==6.0 django-embed-video==1.4.10 easy-thumbnails==2.10.1 fastapi==0.127.0 h11==0.16.0 idna==3.11 Naked==0.1.32 onetimepad==1.4 paperclip==2.7.4 pillow==12.0.0 pycparser==2.23 pycryptodome==3.23.0 pydantic==2.12.5 pydantic_core==2.41.5 pyDes==2.0.1 pyperclip==1.11.0 python-magic==0.4.27 PyYAML==6.0.3 requests==2.32.5 shellescape==3.8.1 sqlparse==0.5.5 starlette==0.50.0 typing-inspection==0.4.2 typing_extensions==4.15.0 tzdata==2025.3 urllib3==2.6.2 uvicorn==0.40.0