python-fastapilisted
Install: claude install-skill martinffx/atelier
# FastAPI - Modern Python Web APIs
FastAPI is a modern, fast web framework for building APIs with Python, using standard Python type hints. FastAPI automatically validates requests, generates OpenAPI documentation, and provides excellent developer experience.
## Quick Start
### Basic Application
```python
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI(
title="My API",
description="API for my application",
version="1.0.0",
)
class Item(BaseModel):
name: str
price: float
@app.get("/")
def read_root():
return {"message": "Hello World"}
@app.post("/items", response_model=Item)
def create_item(item: Item):
return item
```
**Run with:**
```bash
uvicorn main:app --reload
```
## Core Concepts
### Request & Response Models
Use Pydantic models for automatic validation and serialization:
```python
from pydantic import BaseModel, EmailStr, Field
class CreateUserRequest(BaseModel):
email: EmailStr
name: str = Field(min_length=1, max_length=100)
age: int = Field(ge=18, le=120)
class UserResponse(BaseModel):
id: int
email: str
name: str
model_config = {"from_attributes": True} # Enable ORM mode
@app.post("/users", response_model=UserResponse)
def create_user(user: CreateUserRequest):
"""Request validated, response serialized automatically"""
return user
```
See `references/validation.md` for detailed validation patterns including custom validators and field constraints.
### Routers f