FastAPI Cloud CLI

0.15.1 · active · verified Sun Mar 29

fastapi-cloud-cli is a command-line interface tool for deploying and managing FastAPI applications on FastAPI Cloud. It provides commands for logging in, deploying, managing environment variables, and streaming logs. The library is actively maintained, with frequent releases, and is currently at version 0.15.1.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a FastAPI project, create a simple FastAPI application, log in to FastAPI Cloud, and deploy the application using the `fastapi` CLI. The `fastapi[standard]` installation includes `fastapi-cloud-cli`.

# 1. Create a new FastAPI project (requires uv or pip)
# Using uv (recommended):
# uv init myapp
# cd myapp
# uv add "fastapi[standard]"

# Using pip:
mkdir myapp
cd myapp
pip install "fastapi[standard]"

# 2. Create a basic FastAPI application (main.py)
# (Content of main.py)
# from fastapi import FastAPI
# app = FastAPI()
# @app.get("/")
# def read_root():
#     return {"message": "Hello, FastAPI Cloud!"}

# 3. Log in to FastAPI Cloud (if not already logged in)
# This will open a browser for authentication.
# fastapi login

# 4. Deploy your application
# The CLI will detect your app, and for the first deployment,
# it will prompt to select/create a team and app.
# Ensure FASTAPI_CLOUD_TOKEN is set for CI/CD or non-interactive use.
# For example: export FASTAPI_CLOUD_TOKEN=os.environ.get('FASTAPI_CLOUD_TOKEN', '')
fastapi deploy

view raw JSON →