Welcome to the Reception Center
Where curious citizens whisper questions, friendly AI helpers answer in sparkles, and every message travels through tidy little tubes called FastAPI.
Who lives in the Reception Center? ๐
Three little helpers run the whole post office. Each one stands for a real FastAPI superpower โ wrapped in a friendly face.
The Greeter
Pip
GET requestsPip stands at the city gates with a bright blue umbrella, waving every visitor in. Whenever you ask for something โ a fact, a forecast, a friendly hello โ Pip is the one who fetches it for you.
Superpower ยท Knows every door in town and the fastest path to it.
The Mail Sorter
Popy
POST & request bodiesPopy keeps a tidy desk in Postbox Lane. When letters arrive, Popy unfolds them carefully, checks every detail with Pydantic glasses, and stamps them ready for delivery.
Superpower ยท Catches typos and wrong shapes before anyone notices.
The Lantern Keeper
Sunny
Async & streamingSunny tends the Lantern Garden after dusk, lighting many lights at once. Long waits never bother Sunny โ there's always another lantern to tend while the slow ones glow.
Superpower ยท Handles many requests in parallel without breaking a sweat.
A message takes a journey โ๏ธ
Watch a citizen's letter zip across the city to an AI helper, then a gift-wrapped reply zips back. That tiny round-trip is what FastAPI does, all day, very fast.
Knock knock
A citizen sends a tiny request.
Sort & route
FastAPI reads the address and delivers it.
Sparkle reply
The helper sends a happy answer back.
The little street signs ๐ชง
Every door in Citypopy has a name. FastAPI calls these routes. Tap a sign to peek inside.
Neighborhoods of the Reception Center ๐บ๏ธ
Tiny, friendly streets โ each one a real FastAPI idea, dressed in city clothes. Tap a card to wander inside.
In the Town Square, every helper stands behind a polished counter. When you ask a question, they tuck the answer into a tidy JSON box โ labels on the outside, treasures inside โ so your app can unwrap it without confusion.
- โฆReturn a Python dict and FastAPI gift-wraps it as JSON.
- โฆUse response_model to promise the exact shape of the box.
- โฆStatus codes are little colored stickers on the lid.
@app.get("/citizen/{id}")
def greet(id: int):
return {"id": id, "hi": "๐"}Down Postbox Lane, citizens slip detailed letters through the slot. Pydantic, the kind postmaster, reads every line โ checking names, ages, and shapes โ before letting the letter into the city.
- โฆDefine a BaseModel for every incoming letter.
- โฆWrong types get a polite 422 reply, not a crash.
- โฆNested models are letters tucked inside envelopes.
class Wish(BaseModel):
text: str
sparkles: int = 3
@app.post("/wish")
def make(w: Wish): return wIn the Lantern Garden, helpers don't stand in line. While one waits for a slow cloud to answer, the others keep lighting lanterns. Everyone's request glows in turn โ quickly, gently, together.
- โฆasync def lets a helper pause without blocking others.
- โฆawait is a polite 'I'll wait here, you go ahead'.
- โฆGreat for calling AI APIs, databases, and the weather.
@app.get("/weather")
async def sky():
data = await ask_cloud()
return dataAt the top of Whisper Tower, two friends share a long brass tube. Once it's open, every giggle and idea travels instantly โ no knocking, no goodbyes โ until someone gently closes the lid.
- โฆWebSockets stay connected for live chats and games.
- โฆSend and receive whenever โ both sides can speak.
- โฆPerfect for streaming AI replies token by token.
@app.websocket("/chat")
async def chat(ws: WebSocket):
await ws.accept()
await ws.send_text("hi โจ")Build your own little city ๐งฑ
Four cozy steps. By the end, you'll have a real FastAPI app saying hello โ ready for Pip, Popy, and Sunny to move in.
- 1
Open your toolbox
Make a cozy folder for your tiny city, then create a Python world inside it.
mkdir citypopy && cd citypopy python -m venv .venv source .venv/bin/activate
- 2
Invite FastAPI to play
Install FastAPI and Uvicorn โ the little engine that helps your city run.
pip install "fastapi[standard]"
- 3
Build your first door
Make a file called main.py and write your very first route. Pip will greet visitors.
# main.py from fastapi import FastAPI app = FastAPI() @app.get("/") def hello(): return {"message": "hi from Citypopy โจ"} - 4
Open the city gates
Run the server and visit http://127.0.0.1:8000 โ your first citizen has arrived!
fastapi dev main.py
Bonus gift
Visit /docs after starting the server โ FastAPI bakes a beautiful playground for you, free.
Try the tube โจ
Whisper a tiny message. Watch it travel and come home wrapped in a smile. (Pretend FastAPI in your browser โ same idea, no servers harmed.)
You just learned how AI apps talk ๐ซ
FastAPI is the friendly post office of the internet โ small letters, fast tubes, kind helpers. Come back soon to visit the next district of Citypopy.
Citypopy ยท The Reception Center ยท Built with curiosity ๐
Reception API
Deliverable: Create one POST endpoint that accepts a planning request and returns structured JSON with status and summary.
Stretch: Add clear validation errors for missing or invalid fields.
Complete the deliverable first, then unlock the stretch goal.