{
 "kind": "tool",
 "slug": "fastapi",
 "path": "tools/fastapi/",
 "name": "FastAPI",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "HTTP servers and APIs",
   "tools/http-servers/"
  ]
 ],
 "lead": "Build the server side of an app in Python.",
 "chips": [
  {
   "label": "HTTP servers and APIs",
   "path": "tools/http-servers/"
  },
  {
   "label": "PYPI"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "pip install fastapi"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/fastapi/fastapi"
  },
  {
   "label": "Website",
   "href": "https://github.com/fastapi/fastapi"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software",
   "note": "Any use, including paid and closed-source apps.",
   "src": "https://github.com/fastapi/fastapi/blob/master/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 18, 2026",
   "note": "Latest GitHub release Nov 18, 2026. ",
   "src": "https://github.com/fastapi/fastapi"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "465 projects",
   "status": "info",
   "sub": "#2 of 102 in its category",
   "note": "Dependency in 465 public GitHub projects set up for AI coding agents that we scanned (7.4%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://docs.railway.com/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 11, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What FastAPI does",
   "parts": [
    {
     "t": "prose",
     "text": "FastAPI is a free Python framework for the server part of a website or app, the part that receives orders, sign-ups or uploads and answers them. You describe what each request must contain with plain Python types. FastAPI then checks incoming data, sends clear errors and makes a live docs page where you can try every request."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Server for a web or mobile app",
       "text": "Your front end or phone app sends orders, sign-ups and searches to a small Python server that checks each one and answers.",
       "idea": false
      },
      {
       "title": "A docs page to try every request",
       "text": "Open /docs in the browser and send test requests by hand; front-end developers and AI assistants see what the server expects.",
       "idea": false
      },
      {
       "title": "Photo and file uploads",
       "text": "People upload a photo or a document from a form; your server receives it without filling the memory with big files.",
       "idea": false
      },
      {
       "title": "Send the email after answering",
       "text": "After a sign-up the visitor gets the answer at once, and the welcome email goes out a moment later in the background.",
       "idea": false
      },
      {
       "title": "Put an AI model behind a web address",
       "text": "Wrap a Python model or an LLM call in one route, so your site, a chat widget or another service can ask it questions.",
       "idea": true
      },
      {
       "title": "Read a slow file in the background",
       "text": "A user uploads a big spreadsheet; the server answers \"accepted\" right away and works through the file afterwards.",
       "idea": false
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "FastAPI popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "91",
       "of": "/ 100",
       "l": "Gid Score, #8 overall"
      },
      {
       "n": "136M",
       "l": "downloads a week, pypi"
      },
      {
       "n": "105K",
       "l": "GitHub stars"
      },
      {
       "n": "465",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How FastAPI is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "FastAPI is a dependency in 465 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (28.7% of the 1,623 Python ones), #2 of 102 in http servers and apis.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,148; those are left out of every share on this page.",
      "The most used alternative in our scan is Flask (106 projects).",
      "Projects that use it most often also use Uvicorn (92.5%), Pydantic (63.4%), python-dotenv (48.0%).",
      "It is more common in projects set up for OpenClaw (10.5%) than for OpenAI Codex (4.1%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "248 projects, 8.2%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "215 projects, 6.6%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "174 projects, 7.1%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "35 projects, 10.5%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "29 projects, 6.1%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "19 projects, 4.1%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "17 projects, 6.1%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "15 projects, 4.4%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 92.5% of its projects",
       "v": "Uvicorn",
       "path": "tools/uvicorn/"
      },
      {
       "l": "In 63.4% of its projects",
       "v": "Pydantic",
       "path": "tools/pydantic/"
      },
      {
       "l": "In 48.0% of its projects",
       "v": "python-dotenv",
       "path": "tools/python-dotenv/"
      },
      {
       "l": "In 36.3% of its projects",
       "v": "python-multipart",
       "path": "tools/python-multipart/"
      },
      {
       "l": "In 33.1% of its projects",
       "v": "Requests",
       "path": "tools/requests-py/"
      },
      {
       "l": "In 31.8% of its projects",
       "v": "Pydantic Settings",
       "path": "tools/pydantic-settings/"
      },
      {
       "l": "In 30.5% of its projects",
       "v": "NumPy",
       "path": "tools/numpy/"
      },
      {
       "l": "In 29.7% of its projects",
       "v": "SQLAlchemy",
       "path": "tools/sqlalchemy/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "FastAPI in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Plain Python types instead of a schema language",
       "v": "Parameters, query values and bodies are declared once, as function parameters with normal type hints. The README stresses that there is no new syntax or library-specific classes to learn for this."
      },
      {
       "l": "Validation with clear errors, down into nested JSON",
       "v": "If a request does not match the declared types, FastAPI rejects it with an error message. The README says this also applies to deeply nested JSON objects."
      },
      {
       "l": "Two docs UIs at /docs and /redoc",
       "v": "Every app serves interactive documentation in Swagger UI and in ReDoc. Both update as you add endpoints. In Swagger UI you can fill in parameters and send real requests with \"Try it out\"."
      },
      {
       "l": "OpenAPI output that other tools can read",
       "v": "The maintainers say FastAPI is based on and \"fully compatible with\" OpenAPI and JSON Schema. The generated OpenAPI document can feed client code generators for other languages."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Speed-to-code and bug figures are internal estimates",
       "v": "The README claims about 200% to 300% faster feature development and about 40% fewer developer-induced errors. A footnote says these numbers come from the team's own internal tests, not from an independent study."
      },
      {
       "l": "0.143.0 changed OpenTelemetry defaults",
       "v": "The project is still on 0.x versions, and release 0.143.0 is marked as breaking. Automatic exporter setup from <code>OTEL_*</code> variables is now opt-in. Apps that relied on it must set a flag. Apps that configure their own providers and exporters need no changes."
      },
      {
       "l": "Starlette and Pydantic sit underneath",
       "v": "FastAPI delegates the web layer to Starlette and data handling to Pydantic. Request bodies are Pydantic models, so you will be working with Pydantic directly as well as with FastAPI."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Path, query and a Pydantic request body"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Python",
       "code": "from fastapi import FastAPI\nfrom pydantic import BaseModel\n\napp = FastAPI()\n\n\nclass Item(BaseModel):\n    name: str\n    price: float\n    is_offer: bool | None = None\n\n\n@app.get(\"/\")\ndef read_root():\n    return {\"Hello\": \"World\"}\n\n\n@app.get(\"/items/{item_id}\")\ndef read_item(item_id: int, q: str | None = None):\n    return {\"item_id\": item_id, \"q\": q}\n\n\n@app.put(\"/items/{item_id}\")\ndef update_item(item_id: int, item: Item):\n    return {\"item_name\": item.name, \"item_id\": item_id}"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about FastAPI",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/tiangolo",
        "113 GitHub sponsors"
       ]
      },
      {
       "title": "Agent Skills for it",
       "path": "skills/",
       "items": [
        "fastapi-python: Expert in FastAPI Python development with best practices for APIs and async operations",
        "fastapi-templates: Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new",
        "fastapi-expert: Use when building high-performance async Python APIs with FastAPI and Pydantic V2. Invoke to create REST endpoints, define Pydantic models,",
        "fastapi-python: Expert in FastAPI Python development with best practices for APIs and async operations",
        "fastapi-router-py: Create FastAPI routers with CRUD operations, authentication dependencies, and proper response models. Use when building REST API endpoints,",
        "fastapi-pro: Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async p"
       ]
      },
      {
       "title": "Head to head",
       "items": [
        {
         "text": "FastAPI vs Flask",
         "note": "used together in 18 projects",
         "path": "tools/compare/fastapi-vs-flask/"
        },
        {
         "text": "FastAPI vs Starlette",
         "note": "used together in 64 projects",
         "path": "tools/compare/fastapi-vs-starlette/"
        }
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "fastapi-mcp: MCP server from FastAPI apps",
        "fastapi-cli: fastapi dev / run commands",
        "fastapi-cloud-cli: FastAPI Cloud deploy CLI",
        "fastapi-mail: Email sending",
        "fastapi-cache2: Response caching",
        "fastapi-users: User accounts and auth"
       ]
      },
      {
       "title": "More in HTTP servers and APIs",
       "path": "tools/http-servers/",
       "items": [
        {
         "text": "Uvicorn",
         "path": "tools/uvicorn/"
        },
        {
         "text": "Express",
         "path": "tools/express/"
        },
        {
         "text": "cors",
         "path": "tools/cors/"
        },
        {
         "text": "python-multipart",
         "path": "tools/python-multipart/"
        },
        {
         "text": "Hono",
         "path": "tools/hono/"
        },
        {
         "text": "express-rate-limit",
         "path": "tools/express-rate-limit/"
        },
        {
         "text": "multer",
         "path": "tools/multer/"
        },
        {
         "text": "Gunicorn",
         "path": "tools/gunicorn/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "FastAPI",
       "me": true,
       "facts": [
        "MIT",
        "Gid 91",
        "136M/wk"
       ]
      },
      {
       "name": "Flask",
       "why": "Pick Flask for a classic Python site with server-made HTML pages and a large plugin collection, where automatic request checking and docs matter less.",
       "path": "tools/flask/",
       "facts": [
        "BSD-3-Clause",
        "Gid 85",
        "40.4M/wk"
       ]
      },
      {
       "name": "Django",
       "why": "Pick Django when you want a full Python site kit with database models, an admin panel and user accounts built in.",
       "path": "tools/django/",
       "facts": []
      },
      {
       "name": "Express",
       "why": "Pick Express when the server side of your project is JavaScript on Node.js rather than Python.",
       "path": "tools/express/",
       "facts": []
      },
      {
       "name": "Starlette",
       "why": "Lightweight ASGI web framework for building Python APIs and web applications.",
       "path": "tools/starlette/",
       "facts": [
        "BSD-3-Clause",
        "Gid 78",
        "174M/wk"
       ]
      },
      {
       "name": "Tornado",
       "why": "High-performance Python web framework and async networking library for building servers.",
       "path": "tools/tornado/",
       "facts": [
        "Apache-2.0",
        "Gid 76",
        "29.1M/wk"
       ]
      }
     ],
     "more": "Compare FastAPI with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Use FastAPI (pin fastapi[standard]==0.162.4, Python 3.10+) to build a small server with Pydantic models for each request, clear 422 errors for bad input, an upload route, and the /docs page for testing."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install FastAPI with its standard extras (server, form and upload parsing, the fastapi command) into a virtual environment.",
       "code": "uv add \"fastapi[standard]\"",
       "src": "https://github.com/fastapi/fastapi/blob/master/README.md"
      },
      {
       "text": "Write main.py with one route that returns a dictionary.",
       "code": "from fastapi import FastAPI\n\napp = FastAPI()\n\n@app.get(\"/\")\ndef read_root():\n    return {\"Hello\": \"World\"}\n",
       "src": "https://github.com/fastapi/fastapi/blob/master/README.md"
      },
      {
       "text": "Run it with fastapi dev while you build, and with fastapi run on the real server.",
       "code": "fastapi dev",
       "src": "https://fastapi.tiangolo.com/fastapi-cli/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## FastAPI\n- Install with `uv add \"fastapi[standard]\"`, keeping the extra in quotes. With pip, install `fastapi[standard]` inside a virtual environment.\n- Use `fastapi dev` for local work (auto-reload). Use `fastapi run` for production.\n- Declare path, query and body inputs as typed function parameters. A default of `= None` makes a parameter optional. Without it the parameter is required.\n- Model JSON request bodies as Pydantic `BaseModel` classes and take them as a typed parameter.\n- Use `async def` for a path function only if your code uses `async` / `await`. Otherwise use plain `def`.\n- On 0.143.0 or later, if the app relies on `OTEL_*` environment variables for exporters, set `FASTAPI_OTEL_AUTO_CONFIGURE=true` or pass `telemetry={\"auto_configure\": True}`.\n- Check the generated docs at `/docs` or `/redoc` after adding endpoints.\n"
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "pip install fastapi, then fastapi dev or a route with UploadFile / Form",
       "fix": "pip install \"fastapi[standard]==0.162.4\" (quoted), or add python-multipart yourself",
       "why": "The plain package leaves out the server, the fastapi command and the form parser; uploads need python-multipart."
      },
      {
       "dont": "fastapi>=0.100 or an unpinned fastapi in requirements.txt",
       "fix": "fastapi[standard]==0.162.4, then read the release notes before each minor upgrade",
       "why": "Minor versions carry breaking changes; 0.147 to 0.162 changed how omitted booleans, empty strings and unselected files in forms are read."
      },
      {
       "dont": "async def routes that call a blocking library (requests, most database drivers)",
       "fix": "Use plain def for routes that call blocking code; keep async def for code that awaits",
       "why": "Blocking calls inside async def stop the whole server from answering other requests meanwhile."
      },
      {
       "dont": "Query(custom=\"value\") or other unknown keyword arguments copied from older examples",
       "fix": "Query(json_schema_extra={\"custom\": \"value\"})",
       "why": "Since 0.155.0 unknown keyword arguments raise TypeError at startup."
      },
      {
       "dont": "CORSMiddleware with allow_origins=[\"*\"] and cookies or Authorization headers",
       "fix": "List your real front-end origins and set allow_credentials=True",
       "why": "A wildcard origin excludes requests that carry credentials, so logged-in calls from the browser fail."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Which Python version do I need?",
       "a": "Python 3.10 or newer for FastAPI 0.162.4; support for 3.9 was dropped in February 2026.",
       "evidence": {
        "url": "https://pypi.org/pypi/fastapi/json",
        "quote": "\"requires_python\":\">=3.10\""
       }
      },
      {
       "q": "Do I need async and await?",
       "a": "No. Plain def functions work; the docs say to use plain def when a library you call cannot await.",
       "evidence": {
        "url": "https://fastapi.tiangolo.com/async/",
        "quote": "If you are using a third party library that communicates with something (a database, an API, the file system, etc.) and doesn't have support for using await , (this is currently the case for most database libraries), then declare your path operation functions as normally, with just def"
       }
      },
      {
       "q": "Does FastAPI send data about my app anywhere?",
       "a": "Not by default. It records traces and metrics, but since 0.143.0 it sends them only when you turn on automatic setup and give it an address.",
       "evidence": {
        "url": "https://fastapi.tiangolo.com/advanced/opentelemetry/",
        "quote": "By default, FastAPI uses configured providers without adding exporters."
       }
      },
      {
       "q": "Can I use it in a paid product?",
       "a": "Yes. It is MIT-licensed; keep the license notice with copies you ship.",
       "evidence": {
        "url": "https://github.com/fastapi/fastapi/blob/master/README.md",
        "quote": "This project is licensed under the terms of the MIT license."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "pypi fastapi"
  ],
  [
   "Category",
   "HTTP servers and APIs"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "0.143.0, October 8, 2026"
  ],
  [
   "On GitHub since",
   "December 2018"
  ],
  [
   "Gid Score",
   "91.1"
  ],
  [
   "Rank in category",
   "#2 of 102"
  ],
  [
   "GitHub",
   "fastapi/fastapi"
  ],
  [
   "Last change",
   "Nov 18, 2026"
  ]
 ],
 "good": [
  "Versions are still 0.x, and new middle numbers can break code. In October 2026 alone several releases changed how forms, empty fields and defaults are read.",
  "The docs ask you to pin the exact version that works for your app and to upgrade on purpose.",
  "The /docs page loads its scripts and styles from an outside file host by default; you can serve them yourself."
 ],
 "checked_line": "Read by AgentGid from 15 official pages, card checked Nov 11, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/fastapi.png"
}