H
Hostess

Deploy Your Second App

Deploy a FastAPI app with zero-config source builds and route-level metrics in Studio.

This guide walks you through deploying a two-service FastAPI stack from the howl-cloud/awesome-hostess examples repo. You'll use zero-config source: builds (no Dockerfile required) and the hostess-python SDK to unlock per-route metrics in Studio.

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: products, categories, and orders endpoints, instrumented with hostess-python for route-level metrics and traces
  • traffic — HTTP service that sends synthetic requests to api, so you have real data to look at in the Metrics tab

Clone the example

Terminal
git clone https://github.com/howl-cloud/awesome-hostess.git
cd awesome-hostess/simple-fastapi-app
pyproject.toml
hostess.yml

Review the hostess.yml

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: small

A few things to notice:

  • source: instead of build: — Hostess auto-detects the language and framework from the directory and builds the image without a Dockerfile. It detects pyproject.toml, installs dependencies with uv, and figures out how to start the app.
  • public: true on both services — both get a public HTTPS URL.
  • ${api.url} — the internal URL of api is injected into traffic at deploy time. The traffic service uses it to know where to send requests.

Review the instrumentation

The api service adds one line to instrument the FastAPI app with hostess-python:

api/app/main.py
from fastapi import FastAPI
from hostess_sdk.fastapi import instrument

app = FastAPI(title="KickOff Sports API", version="1.0.0")
instrument(app)

That's it. instrument(app) wires up OpenTelemetry FastAPI instrumentation and exports spans to the Hostess collector. On each service's Metrics tab in Studio, this unlocks per-route traffic, latency, and status-code breakdowns — and sampled distributed traces you can open as a waterfall.

Validate and deploy

Terminal
hostess validate
✓ hostess.yml is valid
  2 services: api, traffic
Terminal
hostess deploy
No 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-k7xm9p2q.hostess.run
  traffic: https://simple-fastapi-app-traffic-m3n8x5w2.hostess.run

Both 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-k7xm9p2q.hostess.run/docs

You'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:

Terminal
curl https://simple-fastapi-app-traffic-m3n8x5w2.hostess.run/run
{"sent": 20, "ok": 18, "errors": 2}

The count query parameter controls how many requests to send:

Terminal
curl "https://simple-fastapi-app-traffic-m3n8x5w2.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

Deploy Your Second App | Hostess Docs