FastAPI Setup & Prerequisites
Welcome to FastAPI Mastery Course! FastAPI is a modern, fast (high-performance) web framework for building APIs with Python 3.7+ based on standard Python type hints.
Key features
- Fast: Very high performance, on par with NodeJS and Go
- Fast to code: Increase development speed by 200%-300%
- Fewer bugs: Reduce about 40% of human (developer) errors
- Intuitive: Great editor support with autocompletion
- Easy: Designed to be easy to use and learn
Required setup
# Prerequisites
# Python 3.7+
# pip (Python package manager)
# Virtual environment (recommended)
# Verify Python installation
python --version
python -m pip --version
Environment setup
# Create project directory
mkdir fastapi-course
cd fastapi-course
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install FastAPI and Uvicorn
pip install fastapi uvicorn
Recommended VS Code extensions
- Python (Microsoft)
- Pylance
- Python Docstring Generator
- autoDocstring
- Thunder Client (REST API client)
Project structure
fastapi-project/
├── app/
│ ├── __init__.py
│ ├── main.py
│ ├── api/
│ │ ├── __init__.py
│ │ ├── v1/
│ │ │ ├── __init__.py
│ │ │ ├── endpoints/
│ │ │ └── dependencies.py
│ ├── core/
│ │ ├── config.py
│ │ └── security.py
│ ├── models/
│ ├── schemas/
│ └── crud.py
├── tests/
├── requirements.txt
└── .env.example