https://github.com/diploi/component-fastapi
Official Diploi component for FastAPI
https://github.com/diploi/component-fastapi
asgi-framework asgi-server diploi diploi-template docker fastapi helm-charts kubernetes nodemon python python-template uv uvicorn
Last synced: about 1 month ago
JSON representation
Official Diploi component for FastAPI
- Host: GitHub
- URL: https://github.com/diploi/component-fastapi
- Owner: diploi
- License: mit
- Created: 2025-09-02T12:36:09.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2026-03-25T17:22:11.000Z (about 2 months ago)
- Last Synced: 2026-03-26T17:59:24.974Z (about 2 months ago)
- Topics: asgi-framework, asgi-server, diploi, diploi-template, docker, fastapi, helm-charts, kubernetes, nodemon, python, python-template, uv, uvicorn
- Language: Python
- Homepage: https://diploi.com/
- Size: 131 KB
- Stars: 5
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# FastAPI Component for Diploi
[](https://diploi.com/component/fastapi)
[](https://diploi.com/component/fastapi)
[](https://diploi.com/component/fastapi)
## Operation
### Getting started
1. In the Dashboard, click **Create Project +**
2. Under **Pick Components**, choose **FastAPI**. Here you can also add a frontend framework to create a monorepo app, eg, FastAPI for backend and React+Vite for frontend
3. In **Pick Add-ons**, you can add one or multiple databases to your app
4. Choose **Create Repository** to generate a new GitHub repo
5. Finally, click **Launch Stack**
Link to the full guide https://diploi.com/blog/hosting_fastapi_apps
### Python version
The default Python version is **3.12**. You can change it in two ways:
- **`PYTHON_VERSION` environment variable** - set this in `diploi.yaml` as a [static ENV](https://docs.diploi.com/reference/diploi-yaml/#static-values) under your component's environment variables. This controls the version used by both the development and production environments.
- **`.python-version` file** - add a `.python-version` file to your component's folder containing just the version number (e.g. `3.11`). This is the standard convention used by `uv` and other Python tools, and is a good choice if you want the version pinned in your repository.
If both are set, the `.python-version` file takes precedence.
### Development
The development server is started with:
```sh
uv run --with uvicorn uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload --reload-dir src --reload-dir .venv/lib
```
This can be changed with the `containerCommands.developmentStart` field in `diploi.yaml`.
### Production
Builds a production-ready image. During the build, dependencies are installed with `uv sync` or `uv pip install`. When the container starts, it runs:
```sh
uv run --with uvicorn uvicorn src.main:app --host 0.0.0.0 --port 8000 --proxy-headers
```
This can be changed with the `containerCommands.productionStart` field in `diploi.yaml`.
## Links
- [Adding FastAPI to a project](https://docs.diploi.com/building/components/fastapi)
- [FastAPI documentation](https://fastapi.tiangolo.com/)
- [Python documentation](https://docs.python.org/)
- [uv documentation](https://docs.astral.sh/uv/)