Tip Sheet #64: The One Where I Deploy to FastAPI Cloud


Hi Tip-Sheeters,

I've been looking forward to this week's newsletter for a while -- The One Where I Deploy to FastAPI Cloud (fans of TV's Friends may appreciate the title).

Since I began using FastAPI, some of the best improvements I have seen have been in the "fastapi" command line interface program.

CLIs have become pretty important in their own right lately so if you're interested in the code for the FastAPI CLI you can see it here: https://github.com/fastapilabs. The CLI is built with Typer, another creation of FastAPI's founder creator Sebastián Ramírez Montaño.

The biggest added feature is deployment to a cloud-hosted environment with the command "fastapi deploy".

This deploys your API to FastAPI Cloud, the new hosting service started by Sebastián and his FastAPI Labs company.

I've been on the waitlist for FastAPI Cloud for some months, and recently was excited to read this email:

This week I'll share the steps I used to deploy my Air Travel API to FastAPI cloud (spoiler alert: it was just as easy as advertised.)

Quick Intro to the API Code

As I shared in Tip Sheet #61, my new anchor project uses data from the USDOT's Airline On-Time Performance dataset.

In the last newsletter, I showed how I built out the PostgreSQL database and hosted it online using Supabase.

The code for the core AIR Travel API is available in the Tip Sheet GitHub Repo in Issue #64.

Here is the high-level architecture of the API:

The key components are:

  • PostgreSQL for the backend database
  • SQLAlchemy as the object-relational mapper (ORM) to pull data from the database and convert it to Python objects. I'm using the asynchronous database driver asyncpg for performance under heavy load.
  • FastAPI as the API controller and all-around web framework.
  • Pydantic for validating input and outputs and serializing/de-serializing between JSON and Python objects.

Readers of my book will already be comfortable with most of these components after building their own FastAPI API using Pydantic and SQLAlchemy.

I have added two key additions to make the new anchor project API higher performance: PostgreSQL as the backend database and use of asynchronous coding techniques throughout the API.

I'll demonstrate in future Tip Sheets how these changes enable big gains in API throughput.

Running the API in the dev environment

I perform my development using GitHub Codespaces because it provides me a development container with tight VS Code and GitHub integration.

When sharing my example code I usually try to make it possible to clone the repo and launch with a few commands. Since I'm using a full PostgreSQL server in the Air Travel anchor project this isn't as practical right now, but I'll try to share a SQLite version in the future.

Other than the missing database, you can get the Air Travel API running from the Tip Sheet repo with the following steps:

  • Install uv following the instructions
  • cd to the /64/flights-api directory
  • Create a virtual environment with "uv venv"
  • Install the needed dependencies with "uv sync"
  • Activate your virtual environment with "source .venv/bin/activate"
  • Launch the API with "fastapi run main.py"

It looks for "DATABASE_URL" in the environment. I used a GitHub Codespaces secret to provide the connection string for the remote Supabase database I explained in Tip Sheet #63.

I receive a popup to launch the locally running API. That launches my base health check endpoint ("/") adding a "docs" on the end shows me the built-in Swagger UI docs:

At this point I'm running my API in the GitHub Codespaces development environment. The database is connected to the web-hosted Supabase. Here's a summary architecture, including the database admin tool that I explained in Tip Sheet #63:

Creating my FastAPI Cloud Project

I gotta be honest, I was pretty psyched getting to this part. Ever since Sebastián announced his hosting service I had been itching to give it a try.

After I followed the email to create my account, I was ready to create my first app.

I clicked "Create Your First App" and created Air Travel:

My app is created and I see the App dashboard:

To prepare for app deployment, I add the DATABASE_URL environment variable from the App dashboard (OK full disclosure, the first time I deployed I didn't think of this so I had to add the variable after I deployed, but here's the order you should do it in):

Deploying from the command line

Back in Github Codespaces I type the command "fastapi deploy".

I choose "Login to my existing account" and follow a link to authorize my login to FastAPI Cloud. Back in the CLI, I choose the project I want to deploy my code into:

After a minute or two of deployment and verification, my API is up and running!

The real test is pulling data from that Supabase database -- that's the part I was really curious to see if I could get it working the first try.

I go to the new Anchor project address (go ahead check it out yourself): https://air-travel.fastapicloud.dev/docs

I use the "try it out" on the Flight Info endpoint and day is returned:

🎉 Success! 🎆

My Air Travel Anchor project is hosted in FastAPI Cloud and using the PostgreSQL hosted in Supabase:

Next Steps with the Air Travel Anchor Project

Now I have two fundamental pieces in place: the backend database and the foundational API.

In future Tip Sheets I will build on these by:

  • Going wide: Additional technology exploration including MCP servers, Command Line Interface (CLI), Streamlit data apps, Agent Skills, and more...
  • Going deep: We'll dive into the performance gains that we get from our asynchronous API design and use of PostgreSQL. We'll also expand on the design and features of the API and database (the sky's the limit on those, so we'll see where that takes us).

More to come...

Upcoming Tip Sheet: Interview with Ricardo Heredia

I subscribe to the Underdoc Substack from data scientist Ricardo Heredia and it's a great combination of hands-on projects and sports analytics, which are two of my favorite topics.

Ricardo and I chatted by Google doc and in the next Tip Sheet I'll share some good stuff from him including:

  • His go-to technical stack (lots of cool Python frameworks I haven't used yet)
  • His tips on side projects and skill acquisition
  • How soccer analytics connected him with data pros from three continents

Keep your eye on the inbox for that one!

Keep coding,

Ryan Day

👉 https://tips.handsonapibook.com/ -- no spam, just a short email every couple of weeks

Ryan Day

This is my weekly newsletter where I share some useful tips that I've learned while researching and writing the book Hands-on APIs for AI and Data Science, a #1 New Release from O'Reilly Publishing

Read more from Ryan Day

Hi Tip-Sheeters, Model Context Protocol is a fast-growing standard for providing data and other context to LLM apps. This is an area that Python is really leading the way, namely FastMCP. According to the FastMCP PyPi page, 70% of all MCP servers (in any programming language) are written with some version of FastMCP. Yesterday [Feb. 18, 2026], the FastMCP team released FastMCP 3.0 into production with quite a few new features. I had a chance to chat with Jeremiah Lowin, the creator of FastMCP...

Hi Tip-Sheeters, This week there's big news in Python-land as the Starlette nears the official 1.0 release. I also have an interview with a data scientist who is developing and deploying his code out in public. Let's dive in! Starlette gets the v1.0.0rc release candidate There's major news in the Python community this week as Marcelo Trylesinski (aka Kludex) announced the release candidate v1.0.0rc of Starlette. This means the full production 1.0 release is on its way. Starlette is an...

Hi Tip-Sheeters, Let me be one of the first to tell you 🎉 Happy New Year! 🎆 I hope you're excited about 2026 and the new skills in data science and tech that you'll be picking up. This week, I was able to put my finger on a concept that had been bouncing around in my head for a while: building a career that benefits from rapid changes. An antifragile career I enjoy reading the Incerto Series of books from Nassim Nicholas Taleb. He has a writing style that is challenging and entertaining, and...