My First FastAPI Project: Step-by-Step from Setup to Test

My First FastAPI Project

Today, I built my first working web project using FastAPI. I’m sharing the whole process step-by-step — what I did, what issues I encountered, and how I learned.

First, I Installed Visual Studio Code

While installing VS Code, I made sure to select the following options:

  • Add “Open with Code” to the right-click menu
  • Add to PATH (this allows using the code command in the terminal)
  • Register as the default editor for supported file types

Then I Installed FastAPI and Uvicorn

I opened a terminal inside my folder and ran these:

pip install fastapi
pip install uvicorn

I Created a File Called main.py

In this file, I wrote the following code:

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
return {"message": "Hello World, FastAPI works!"}

I Ran the Project with Uvicorn

In the terminal, I ran:

uvicorn main:app --reload

I opened my browser and went to http://127.0.0.1:8000. The result:

{"message":"Hello World, FastAPI works!"}

I Tested It Through Swagger UI

I also went to http://127.0.0.1:8000/docs. From there, I could easily test the API using the built-in interface.

What I Actually Did

  • I installed VS Code properly (including PATH and context menu options)
  • I made sure the code command worked from the terminal
  • I opened a new folder and created main.py
  • I installed FastAPI and Uvicorn
  • I wrote a very basic FastAPI route
  • I ran it with uvicorn main:app --reload
  • I tested the root endpoint both in the browser and Swagger UI

What I Learned

  • I got more comfortable using the terminal
  • I got used to opening folders in terminal
  • I practiced creating/deleting folders and files
  • I saw how quickly a backend app can be tested live
  • I learned to solve a few small issues along the way (like fixing code not working or installing the correct version of VS Code)

Want to Try It Too?

If you also want to try building a FastAPI app like I did, here are the basic steps:

  1. Download and install VS Code
  2. During installation, make sure to check:
    • Add to PATH
    • “Open with Code” in the right-click menu
  3. Open a terminal inside your project folder
  4. Install FastAPI and Uvicorn:
pip install fastapi uvicorn
  1. Create main.py and paste the basic route
  2. Start your app:
uvicorn main:app --reload
  1. Test from browser:
    • http://127.0.0.1:8000
    • http://127.0.0.1:8000/docs

That’s how I started — just small steps, repeated often.

I’ll keep learning and sharing my journey

Leave a Reply

Your email address will not be published. Required fields are marked *