How to deploy your first app on FastAPI Cloud

# Introduction
FastAPI has grown far beyond being a simple Python library for working with APIs. It has become a comprehensive ecosystem that many developers rely on to build modern web applications, especially AI and machine learning projects. One of the reasons FastAPI is so popular is its speed, simplicity, and developer-friendly design.

Image from FastAPI Cloud
Now, with FastAPI CloudThe shipping experience becomes much easier as well. Instead of spending time configuring servers and deployment pipelines, you can deploy an application in seconds using the FastAPI Cloud Command-line interface (CLI). Setup feels straightforward, lightweight, and very close to the smooth experience developers expect from modern managed platforms.
At the time of writing, access is still out on a waiting list. I applied a few months ago and just got access, so I wanted to put together a simple guide based on my experience. In this tutorial, I'll walk through the basic setup process and show how to install a small FastAPI app in just a few steps.
# Creating a Project
In this tutorial, you will build a simple metal dashboard using FastAPI. The app will fetch gold and silver prices from the API, return the data in JSON format, and display the prices in the browser using a small HTML interface.
Before you begin, make sure you have:
- uv installed project framework, or the latest supported version of Python.
- FastAPI Cloud account.
To get started, create a new FastAPI project with the official setup command:
uvx fastapi-new metals-live
cd metals-live
In a few seconds, FastAPI will generate the project structure and install the required dependencies.

Photo by the Author
Next, activate the virtual environment within the project directory.
On Linux/macOS:
source .venv/bin/activate
In Windows PowerShell:
.venvScriptsActivate.ps1
# Add httpx
Next, install the packages that the operating system will need. We will use httpx to download live gold and silver prices from the API, and we will ensure that the standard FastAPI add-on is included so that the application works and is used smoothly without any dependencies.
uv add httpx "fastapi[standard]"
This command adds httpx for making outbound API requests and includes standard FastAPI dependencies that are often needed for development and deployment.
# Changing the Default Application
Now it's time to replace the default FastAPI application with the version you will actually use.
Here's what the default project structure looks like:

Photo by the Author
Open it main.py and replace its contents with the custom code shown below. This version does two things: it downloads live gold and silver prices from the Gold API, and it uses a simple browser dashboard that automatically updates every 15 seconds.
Paste this into main.py:
import httpx
from fastapi import FastAPI, HTTPException
from fastapi.responses import HTMLResponse
app = FastAPI(title="Live Gold & Silver Prices")
GOLD_API_BASE = "
async def fetch_price(symbol: str):
url = f"{GOLD_API_BASE}/price/{symbol}"
async with httpx.AsyncClient(timeout=10.0) as client:
response = await client.get(url)
if response.status_code != 200:
raise HTTPException(status_code=502, detail=f"Failed to fetch {symbol} price")
data = response.json()
return {
"symbol": data.get("symbol", symbol),
"name": data.get("name", symbol),
"price": data.get("price"),
"currency": data.get("currency", "USD"),
"updatedAt": data.get("updatedAt") or data.get("timestamp"),
}
@app.get("/api/prices")
async def get_prices():
gold = await fetch_price("XAU")
silver = await fetch_price("XAG")
return {
"gold": gold,
"silver": silver,
}
@app.get(" response_class=HTMLResponse)
async def home():
return """
Live Gold & Silver Prices
Prices refresh automatically every 15 seconds.
"""
What this code does:
- Creates a FastAPI application.
- Downloads live gold and silver prices from API.
- Returns data with
/api/prices. - It works with a simple HTML dashboard in
/. - Updates displayed prices every 15 seconds.
# On-site inspection
Before deployment, it's a good idea to run the application locally and make sure everything is working as expected. FastAPI makes this easy with its built-in development server.
Start the app by:
Once the server is started, FastAPI will generate the local URL for your application and the URL for the test endpoints documentation.

Photo by the Author
Open your browser and go to:
You should see your live dashboard showing gold and silver prices. The values will be updated automatically every 15 seconds.

Photo by the Author
You can also test the JSON endpoint directly at:
This is especially useful if you want to test the raw response or later connect the data to another frontend or application.

Photo by the Author
# Deploys to FastAPI Cloud
Once the app is running locally, you're ready to deploy it to the FastAPI Cloud. The deployment flow is very simple and starts with a single command.
Run:
The CLI will guide you through connecting your FastAPI Cloud account and completing the setup. During onboarding, you may be asked a few short questions, such as your team name, app name, and deployment settings.

Photo by the Author
Once that's done, FastAPI Cloud will build and deploy your app for you.

Photo by the Author
After the deployment is complete, you'll get a live public URL for your app — for example:

Photo by the Author
FastAPI Cloud also provides you with useful API documentation on:
docs

Photo by the Author
This is useful because you can test your API directly in the browser, without needing additional tools.

Photo by the Author
# Application Monitoring
After deployment, you can use the FastAPI Cloud dashboard to monitor your application and check its logs.
To view logs:
- Open the FastAPI Cloud dashboard.
- Go to Applications.
- Choose your app.
- Open it Timber.
This is useful for testing whether your application is working correctly, detecting API errors, and debugging problems after deployment.

Photo by the Author
FastAPI Cloud also starts to feel close to similar platforms Supabase or Vercelwith managed hosting, fast CLI-based deployment, and additional integrations you can plug into your application as you grow it.

Photo by the Author
# Wrapping up
FastAPI Cloud makes it easy to take a small FastAPI application from local development to live deployment. In this guide, we built a simple live instrument dashboard, tested it locally, deployed it with a single command, and checked the logs after launch.
For the first deployment, the workflow is straightforward and a great introduction to the FastAPI Cloud experience.
Abid Ali Awan (@1abidiawan) is a data science expert with a passion for building machine learning models. Currently, he specializes in content creation and technical blogging on machine learning and data science technologies. Abid holds a Master's degree in technology management and a bachelor's degree in telecommunication engineering. His idea is to create an AI product using a graph neural network for students with mental illness.



