Optional Open source
Use FastAPI for a Python API
Use FastAPI for a Python service that only answers JSON, and pin its minor version.
Cost
Open source. MIT licence, free to run on your own servers.
How to do it
FastAPI first came out in December 2018, and version 0.156.8 shipped in October 2026. It has never reached version 1.0, so it fails the five-year stable test, and minor versions can break code. It passes the rest. It has about 114 million weekly downloads and an MIT licence. It was used by 14.8% of developers in the 2025 Stack Overflow survey, above Flask and Django. Record the exception as the first chapter asks. Choose something else when the app also needs pages, accounts and an admin, which Django brings. It checks input with Pydantic, as Use Zod or Pydantic to check every input says.
Examples
Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.
Python example
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Order(BaseModel):
id: int
total_cents: int
@app.get("/orders/{order_id}")
def get_order(order_id: int) -> Order:
return Order(id=order_id, total_cents=4200)
JavaScript example
const PINNED_MINOR = /^fastapi>=0\.(\d+)(\.\d+)?,<0\.(\d+)$/;
export const isMinorPinned = requirement => {
const match = PINNED_MINOR.exec(requirement.replace(/\s/g, ''));
return Boolean(match) && Number(match[3]) === Number(match[1]) + 1;
};
How to check
requirements or pyproject pins FastAPI to one minor version, such as fastapi>=0.156,<0.157, and a decision record names the exception.
Sources
Related rules
- Use Zod or Pydantic to check every input in Software choices
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers software choices playbook with a link to https://agentwranglers.se/playbook/stack/web-frameworks/fastapi. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.