Before You Start
Python 3.8+
FastAPI requires Python 3.8 or higher
pip
Python package manager
Get It Running
Quick Start
Create a FastAPI project.
First, open your Terminal:
Create project directory
mkdir my-fastapi-app && cd my-fastapi-app
Create virtual environment
python3 -m venv venv
Activate it
source venv/bin/activate
Install FastAPI and Uvicorn
pip install fastapi uvicorn
Create main.py with your API
Run
uvicorn main:app --reload
Open http://localhost:8000
View auto-generated docs at http://localhost:8000/docs
Example code:
# main.py
from fastapi import FastAPI
app = FastAPI()
@app.get('/')
def read_root():
return {'Hello': 'World'}
@app.get('/items/{item_id}')
def read_item(item_id: int, q: str = None):
return {'item_id': item_id, 'q': q}
Start Vibe Coding
Create your project, push to GitHub, and start coding with AI in one go.
First, make sure you have these installed:
- Git - Version control
- GitHub CLI - Create repos from terminal
- Cursor - AI-powered code editor
Download and run a script that sets up everything automatically.
How to run on Mac
1. Open Terminal (Cmd + Space, type "Terminal")
2. Navigate to Downloads: cd ~/Downloads
3. Run: chmod +x setup-*.sh && ./setup-*.sh
How to run on Windows
1. Open your Downloads folder
2. Double-click the .bat file
3. If warned, click "More info" → "Run anyway"
Manual Setup (Copy & Paste)
# Enter a project name above to generate your script
Paste this in your terminal to create your project, initialize git, push to GitHub, and open in Cursor.
Build with Claude Code
Use Claude Code to build your FastAPI project by describing what you want in plain English.
Get your Anthropic API key (one-time)
You'll need an API key to use Claude Code. It's free to sign up!
- 1. Go to console.anthropic.com and sign up or log in
- 2. Navigate to API Keys in the sidebar
- 3. Click Create Key and copy it somewhere safe
Add your API key to your system (one-time)
Run this in your terminal to save the key permanently. Replace your-api-key with your actual key.
echo 'export ANTHROPIC_API_KEY="your-api-key"' >> ~/.zshrc && source ~/.zshrc
This adds the key to your shell config so it's always available.
Install Claude Code (one-time setup)
Run this command once in your terminal from anywhere.
npm install -g @anthropic-ai/claude-code
Start Claude in your project
Navigate to your FastAPI project folder, then run:
claude
Describe what you want to build
Claude will read your project and help you build it. Try prompts like:
Go Live
Ready to share your FastAPI project with the world? Deploy it in minutes.
Deploy Your Project