Description
# FastAPI CLI <a href="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml" target="_blank"> <img src="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml/badge.svg" alt="Test"> </a> <a href="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml" target="_blank"> <img src="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml/badge.svg" alt="Publish"> </a> <a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi-cli" target="_blank"> <img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi-cli.svg" alt="Coverage"> <a href="https://pypi.org/project/fastapi-cli" target="_blank"> <img src="https://img.shields.io/pypi/v/fastapi-cli?color=%2334D058&label=pypi%20package" alt="Package version"> </a> --- **Source Code**: <a href="https://github.com/fastapi/fastapi-cli" target="_blank">https://github.com/fastapi/fastapi-cli</a> --- Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀 ## Description **FastAPI CLI** is a command line program `fastapi` that you can use to serve your FastAPI app, manage your FastAPI project, and more. When you install FastAPI (e.g. with `pip install "fastapi[standard]"`), it includes a package called `fastapi-cli`, this package provides the `fastapi` command in the terminal. To run your FastAPI app for development, you can use the `fastapi dev` command: <div class="termy"> ```console $ fastapi dev main.py FastAPI Starting development server 🚀 Searching for package file structure from directories with __init__.py files Importing from /home/user/code/awesomeapp module 🐍 main.py code Importing the FastAPI app object from the module with the following code: from main import app app Using import string: main:app server Server started at http://127.0.0.1:8000 server Documentation at http://127.0.0.1:8000/docs tip Running in development mode, for production use: fastapi run Logs: INFO Will watch for changes in these directories: ['/home/user/code/awesomeapp'] INFO Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO Started reloader process [4106097] using WatchFiles INFO Started server process [4106120] INFO Waiting for application startup. INFO Application startup complete. ``` </div> That command line program called `fastapi` is **FastAPI CLI**. FastAPI CLI takes the path to your Python program and automatically detects the variable with the FastAPI (commonly named `app`) and how to import it, and then serves it. For production you would use `fastapi run` instead. 🚀 Internally, **FastAPI CLI** uses <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a>, a high-performance, production-ready, ASGI server. 😎 ## `fastapi dev` When you run `fastapi dev`, it will run on development mode. By default, it will have **auto-reload** enabled, so it will automatically reload the server when you make changes to your code. This is resource intensive and could be less stable than without it, you should only use it for development. By default it will listen on the IP address `127.0.0.1`, which is the IP for your machine to communicate with itself alone (`localhost`). ## `fastapi run` When you run `fastapi run`, it will run on production mode by default. It will have **auto-reload disabled** by default. It will listen on the IP address `0.0.0.0`, which means all the available IP addresses, this way it will be publicly accessible to anyone that can communicate with the machine. This is how you would normally run it in production, for example, in a container. In most cases you would (and should) have a "termination proxy" handling HTTPS for you on top, this will depend on how you deploy your application, your provider might do this for you, or you might need to set it up yourself. You can learn more about it in the <a href="https://fastapi.tiangolo.com/deployment/" class="external-link" target="_blank">FastAPI Deployment documentation</a>. ## License This project is licensed under the terms of the MIT license.
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 0.0.24 | Imported from PyPI (0.0.24) | Low | 4/21/2026 |
| 0.0.23 | ### Breaking Changes * ➖ Drop support for Python 3.9. PR [#309](https://github.com/fastapi/fastapi-cli/pull/309) by [@tiangolo](https://github.com/tiangolo). ### Refactors * 🎨 Update format and types for Python 3.10. PR [#310](https://github.com/fastapi/fastapi-cli/pull/310) by [@tiangolo](https://github.com/tiangolo). | Low | 2/16/2026 |
| 0.0.21 | ### Internal * 👷 Update build setup for `fastapi-cli-slim`, deprecate it, and make it only depend on `fastapi-cli`. PR [#300](https://github.com/fastapi/fastapi-cli/pull/300) by [@tiangolo](https://github.com/tiangolo). * ⬆ Bump typer from 0.21.1 to 0.21.2. PR [#298](https://github.com/fastapi/fastapi-cli/pull/298) by [@dependabot[bot]](https://github.com/apps/dependabot). * ⬆ Bump fastapi-slim from 0.128.6 to 0.128.7. PR [#297](https://github.com/fastapi/fastapi-cli/pull/297) by [@dependa | Low | 2/11/2026 |
| 0.0.20 | ### Features * ✨ Add --reload-dir option to dev command. PR [#267](https://github.com/fastapi/fastapi-cli/pull/267) by [@patrick91](https://github.com/patrick91). | Low | 12/22/2025 |
| 0.0.19 | ### Breaking Changes * 🔧 Drop support for Python 3.8. PR [#269](https://github.com/fastapi/fastapi-cli/pull/269) by [@patrick91](https://github.com/patrick91). | Low | 12/22/2025 |
| 0.0.18 | ### Features * ➕ Add `fastapi-new` in `new` optional dependency group. PR [#241](https://github.com/fastapi/fastapi-cli/pull/241) by [@savannahostrowski](https://github.com/savannahostrowski). ### Fixes * 🐛 Fix log alignment when pressing Ctrl+C to stop server. PR [#253](https://github.com/fastapi/fastapi-cli/pull/253) by [@savannahostrowski](https://github.com/savannahostrowski). | Low | 12/22/2025 |
| 0.0.17 | ### Upgrades * ➖ Drop support for Pydantic v1. PR [#268](https://github.com/fastapi/fastapi-cli/pull/268) by [@patrick91](https://github.com/patrick91). ### Internal * 👷 Configure coverage, error on main tests, don't wait for Smokeshow. PR [#265](https://github.com/fastapi/fastapi-cli/pull/265) by [@YuriiMotov](https://github.com/YuriiMotov). * 👷 Run Smokeshow always, even on test failures. PR [#264](https://github.com/fastapi/fastapi-cli/pull/264) by [@YuriiMotov](https://github.com | Low | 12/22/2025 |
| 0.0.16 | ### Fixes * 🐛 Fix support for Pydantic v1. PR [#240](https://github.com/fastapi/fastapi-cli/pull/240) by [@patrick91](https://github.com/patrick91). | Low | 11/10/2025 |
| 0.0.15 | ### Features * ✨ Add support for reading configuration from `pyproject.toml`. PR [#236](https://github.com/fastapi/fastapi-cli/pull/236) by [@patrick91](https://github.com/patrick91). You can use it in `pyproject.toml` like: ```toml [tool.fastapi] entrypoint = "some.importable_module:app_name" ``` ### Internal * ⬆ Bump actions/upload-artifact from 4 to 5. PR [#232](https://github.com/fastapi/fastapi-cli/pull/232) by [@dependabot[bot]](https://github.com/apps/dependabot). * ⬆ B | Low | 11/10/2025 |
| 0.0.14 | ### Upgrades * ⬆️ Add support for Python 3.13 and 3.14. PR [#225](https://github.com/fastapi/fastapi-cli/pull/225) by [@svlandeg](https://github.com/svlandeg). ### Internal * ⬆ Bump tiangolo/issue-manager from 0.5.1 to 0.6.0. PR [#220](https://github.com/fastapi/fastapi-cli/pull/220) by [@dependabot[bot]](https://github.com/apps/dependabot). | Low | 10/20/2025 |
| 0.0.13 | ### Features * ✨ Allow to use `-h` for help. PR [#191](https://github.com/fastapi/fastapi-cli/pull/191) by [@patrick91](https://github.com/patrick91). | Low | 9/20/2025 |
| 0.0.12 | ### Features * ✨ Add support for the PORT environment variable. PR [#209](https://github.com/fastapi/fastapi-cli/pull/209) by [@buurro](https://github.com/buurro). ### Internal * ⬆ Bump mypy from 1.14.0 to 1.14.1. PR [#207](https://github.com/fastapi/fastapi-cli/pull/207) by [@dependabot[bot]](https://github.com/apps/dependabot). * ⬆ Bump actions/setup-python from 5 to 6. PR [#201](https://github.com/fastapi/fastapi-cli/pull/201) by [@dependabot[bot]](https://github.com/apps/dependabot | Low | 9/17/2025 |
| 0.0.11 | ### Features * ✨ Add support for passing apps as `fastapi run --entrypoint some.importable_module:app_name`. PR [#199](https://github.com/fastapi/fastapi-cli/pull/199) by [@patrick91](https://github.com/patrick91). If you have been using Uvicorn like: ```console $ uvicorn some.importable_module:app_name ``` Now you can use the same "entrypoint" syntax with `fastapi`: ```console $ fastapi run -e some.importable_module:app_name ``` Or: ```console $ fastapi run --entrypoin | Low | 9/9/2025 |
| 0.0.10 | ### Features * Add CLI option `--forwarded-allow-ips`. PR [#113](https://github.com/fastapi/fastapi-cli/pull/113) by [@Riuzaky77](https://github.com/Riuzaky77). ### Internal * ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#147](https://github.com/fastapi/fastapi-cli/pull/147) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci). * ⬆ Bump ruff from 0.11.2 to 0.12.11. PR [#196](https://github.com/fastapi/fastapi-cli/pull/196) by [@dependabot[bot]](https://github.com/apps/depend | Low | 8/31/2025 |
| 0.0.9 | ### Fixes * 🔧 Remove command script `fastapi`, let it be provided by the `fastapi` package. PR [#197](https://github.com/fastapi/fastapi-cli/pull/197) by [@tiangolo](https://github.com/tiangolo). | Low | 8/31/2025 |
| 0.0.8 | ### Features * ➕ Add optional dependency on `fastapi-cloud-cli`. PR [#181](https://github.com/fastapi/fastapi-cli/pull/181) by [@tiangolo](https://github.com/tiangolo). This will allow you to deploy to [FastAPI Cloud](https://fastapicloud.com) with the `fastapi deploy` command. Installing `fastapi-cli[standard]` now includes `fastapi-cloud-cli`. If you want to install `fastapi-cli` without `fastapi-cloud-cli`, you can install instead `fastapi-cli[standard-no-fastapi-cloud-cli]`. Y | Low | 7/7/2025 |
| 0.0.7 | ### Fixes * 🐛 Do not disable existing loggers. PR [#132](https://github.com/fastapi/fastapi-cli/pull/132) by [@kraftp](https://github.com/kraftp). ### Internal * 🚨 Format new test. PR [#137](https://github.com/fastapi/fastapi-cli/pull/137) by [@tiangolo](https://github.com/tiangolo). * ⬆ Bump pypa/gh-action-pypi-publish from 1.12.2 to 1.12.3. PR [#134](https://github.com/fastapi/fastapi-cli/pull/134) by [@dependabot[bot]](https://github.com/apps/dependabot). * ⬆ [pre-commit.ci] pre- | Low | 12/15/2024 |
| 0.0.6 | ### Features * ✨ Improve UI for `fastapi dev` and `fastapi run`. PR [#95](https://github.com/fastapi/fastapi-cli/pull/95) by [@patrick91](https://github.com/patrick91). ### Fixes * 🐛 Use correct syntax for links. PR [#131](https://github.com/fastapi/fastapi-cli/pull/131) by [@patrick91](https://github.com/patrick91). ### Internal * 👷 Update `labeler.yml`. PR [#101](https://github.com/fastapi/fastapi-cli/pull/101) by [@tiangolo](https://github.com/tiangolo). * 👷 Do not sync lab | Low | 12/4/2024 |
| 0.0.5 | ### Breaking Changes * ♻️ Add `fastapi-cli[standard]` including Uvicorn, make `fastapi-cli` and `fastapi-cli-slim` have the same packages. PR [#55](https://github.com/fastapi/fastapi-cli/pull/55) by [@tiangolo](https://github.com/tiangolo). * ➕ Keep Uvicorn in default dependencies. PR [#57](https://github.com/fastapi/fastapi-cli/pull/57) by [@tiangolo](https://github.com/tiangolo). #### Summary Install with: ```bash pip install "fastapi[standard]" ``` Or if for some reason inst | Low | 8/2/2024 |
| 0.0.4 | ### Fixes * 🔧 Make FastAPI and Uvicorn optional dependencies, to avoid circular dependencies. PR [#25](https://github.com/tiangolo/fastapi-cli/pull/25) by [@tiangolo](https://github.com/tiangolo). ### Internal * ⬆ Bump actions/cache from 3 to 4. PR [#5](https://github.com/tiangolo/fastapi-cli/pull/5) by [@dependabot[bot]](https://github.com/apps/dependabot). * ⬆ Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.14. PR [#2](https://github.com/tiangolo/fastapi-cli/pull/2) by [@dependa | Low | 5/19/2024 |
| 0.0.3 | ### Features * ✨ Add optional `--workers` CLI option, and fix CI for test-redistribute. PR [#12](https://github.com/tiangolo/fastapi-cli/pull/12) by [@PokkaKiyo](https://github.com/PokkaKiyo). ### Upgrades * ➖ Relax Uvicorn pin. PR [#16](https://github.com/tiangolo/fastapi-cli/pull/16) by [@tiangolo](https://github.com/tiangolo). ### Docs * 📝 Add note about Uvicorn as the high-performance server running underneath. PR [#9](https://github.com/tiangolo/fastapi-cli/pull/9) by [@tian | Low | 5/7/2024 |
| 0.0.2 | First public working version. 🚀 ### Fixes * 👷 Tweak CI testing and fix import error detection for Python 3.8. PR [#8](https://github.com/tiangolo/fastapi-cli/pull/8) by [@tiangolo](https://github.com/tiangolo). | Low | 5/2/2024 |
