Install Fastapi And Run Your First Fastapi Server On Windows
Last Updated :
28 Apr, 2025
FastAPI is a modern, fast web framework for building APIs with Python 3.7+ based on standard Python-type hints. In this article, we'll walk through the process of installing FastAPI and creating a simple FastAPI server on a Windows system.
Pre-Requisite:
Install And Run Python Fastapi Server On Windows
Below is the step-by-step procedure by which we can install and run the FastAPI server on Windows in Python:
Step 1: Install FastAPI and Uvicorn
Open a command prompt or PowerShell window and use the following command to install FastAPI and Uvicorn:
pip install fastapi uvicorn
This command installs the FastAPI framework along with Uvicorn, a lightweight ASGI server.
Step 2: File Structure

Step 3: Create a FastAPI App
Create a new file, for example, main.py, and open it with your preferred code editor. This simple FastAPI application defines an instance of the FastAPI class and a single route that responds to HTTP GET requests at the root path ("/") with a JSON response.
Python3
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
Step 4: Run the FastAPI Server
Open a command prompt or PowerShell window and navigate to the directory where your main.py file is located. Use the following command to start the FastAPI server:
uvicorn main:app --reload
This command tells Uvicorn to run the FastAPI application in the main module (from main.py) and use the app instance. The --reload option enables automatic reloading of the server when code changes are detected.

Step 5: Access the FastAPI Application
Once the server is running, open your web browser and navigate to
http://127.0.0.1:8000/

Congratulations! You have successfully installed FastAPI, created a simple FastAPI application, and run it on your Windows machine. You can now build upon this foundation to create more complex APIs using FastAPI's features and capabilities.
Similar Reads
Install Redis On Windows Redis is an in-memory data structure store, and it is widely used as a caching mechanism and message broker. Installing Redis with Python on Windows can be a bit challenging due to the absence of native support for Windows in the Redis project. However, there are several approaches to achieve this.
3 min read
How to Install and Run Apache Kafka on Windows? Apache Kafka is an open-source application used for real-time streams for data in huge amount. Apache Kafka is a publish-subscribe messaging system. A messaging system lets you send messages between processes, applications, and servers. Broadly Speaking, Apache Kafka is software where topics can be
2 min read
How to install and use Naabu in Windows Enumeration and Scanning are integral parts of the Security Research Process. Getting information about the network structure of the target domain is very important. Automation Intelligence tools help us in improving the security research process and save lots of time. So Naabu is an automated tool
5 min read
AWS CLI for Windows File Server Today, in a cloud-based world, businesses and IT practitioners need to obtain effective and scalable storage solutions. Amazon Web Services has multiple cloud-based storage solutions, including Amazon FSx for Windows File Server, which is fully managed, scalable, and available with a highly reliable
5 min read
Introduction to FastAPI And Installation Introduction to FastAPIFastAPI is a modern, fast (as the name suggests), and highly performant Python web framework used for building APIs. It is built on top of standard Python-type hints and is powered by asynchronous programming using Python's "asyncio". FastAPI is known for its speed, simplicity
4 min read
How to Download and Install RapidMiner on Windows? RapidMiner is software used in the field of data science for different purposes like machine learning, sentiment analysis, text mining, data cleaning, data mining, etc. It is developed by RapidMiner Incorporation in 2001. It is built by using the Java programming language. Earlier it was known as YA
2 min read