Deploy Your Second App
Deploy a FastAPI application with Hostess in under 5 minutes.
This guide walks you through deploying a two-service FastAPI stack from the howl-cloud/awesome-hostess examples repo.
This guide assumes you have the Hostess CLI installed and are logged in. If not, follow Deploy Your First App first.
What You'll Deploy
- api — KickOff Sports product catalog endpoints, with metrics and traces in Studio
- traffic — HTTP service that sends synthetic requests to
api, so you have real data to look at in the Metrics tab
Clone the example
git clone https://github.com/howl-cloud/awesome-hostess.git
cd awesome-hostess/simple-fastapi-appReview the hostess.yml
version: "1.0"
name: simple-fastapi-app
services:
api:
type: fastapi
source: ./api
public: true
resources: small
traffic:
type: fastapi
source: ./traffic
public: true
env:
API_URL: ${api.url}
depends_on:
- api
resources: smallA few things to notice:
source:— Hostess installs application dependencies from the project and starts the FastAPI application.public: trueon both services — both get a public HTTPS URL.${api.url}— the internal URL ofapiis injected intotrafficat deploy time. The traffic service uses it to know where to send requests.
API Insights
The api service is type: fastapi with source:. Route-level Insights work with no application code.
On the Metrics tab in Studio you'll get per-route traffic, latency, and status-code breakdowns, plus sampled distributed traces you can open as a waterfall. See Insights.
Validate and deploy
hostess validate✓ hostess.yml is valid
2 services: api, traffichostess deployNo project found. Create one?
Project name: simple-fastapi-app
✓ Project "simple-fastapi-app" created
Environment: preview
api → Installing
traffic → Installing
api ✓ built
traffic ✓ built
✓ Deployment complete (dep_def456)
api: https://simple-fastapi-app-api-able-arc.hostess.run
traffic: https://simple-fastapi-app-traffic-swift-meadow.hostess.runBoth services build in parallel. The CLI streams live phase labels as each image is built and pushed.
Browse the API
FastAPI generates interactive documentation at /docs. Open the api URL from the deploy output with /docs appended:
https://simple-fastapi-app-api-able-arc.hostess.run/docsYou'll see all available endpoints — products, categories, and orders — and can try them directly from the browser.
Generate traffic
The traffic service exposes a GET /run endpoint that fires a burst of requests at the api. Visit the URL from the deploy output:
curl https://simple-fastapi-app-traffic-swift-meadow.hostess.run/run{"sent": 20, "ok": 18, "errors": 2}The count query parameter controls how many requests to send:
curl "https://simple-fastapi-app-traffic-swift-meadow.hostess.run/run?count=100"Run it a few times to build up enough data to see in Studio.
View metrics in Studio
Open hostess.sh and navigate to your simple-fastapi-app project. Select the deployment, then click the api service and open the Metrics tab.
You'll see:
- Request rate and latency per route (e.g.
GET /products,GET /products/{product_id},POST /orders) - Status code breakdown — including the intentional 404s the traffic service sends to
/products/99 - Traces — click any route row to open sampled traces as a span waterfall
What's Next
- Next.js + FastAPI + Postgres — Add a frontend and database to your API
- Managing Secrets — Store API keys and credentials securely
- Custom Domains — Point your own domain at your services
- Insights — Learn what the Metrics tab shows and how sampling works