Cover image

FastAPI on Diploi: Code, preview, and ship without DevOps

Javier

September 22, 2025

Updated

Spin up FastAPI on Diploi with zero server configuration

FastAPI is a high-performance Python framework designed for APIs. It uses type hints, supports async out of the box, and auto-generates OpenAPI docs, which makes it ideal for both prototypes and production services.

In this guide, we’ll start from a simple FastAPI project and have it running on Diploi in minutes. Diploi handles the build, configuration, and runtime for you.

We’ll create your FastAPI project in Diploi, promote it to production, and then connect a custom domain.

Let’s get started.


Table of contents


Getting started with FastAPI on Diploi

What you need

To follow along, you’ll need:

  • A GitHub account
  • A Diploi account

You can create a Diploi account for free, no credit card required.

How to create a FastAPI app

Now, to get started, you’ll need to create a Project using FastAPI, this is how:

  • Create a new project: Once you sign-in, you should land in the Project creation page, but in case this is not your first time using Diploi, access your Dashboard and click the Create Project + button. Create project

  • Choose the FastAPI component: In Pick Components, select FastAPI (you may find it under Python/FastAPI). If you want a full-stack setup, add a frontend too, e.g., pair a FastAPI backend with a React UI in the same project. Selecting the FastAPI component

  • Add optional services: In Pick Add-ons, attach databases or caches if needed (PostgreSQL, Redis, etc.). You can skip this now and add them later by editing the diploi.yaml at the project root. Selecting add-ons

  • Create a repository: Choose Create Repository, so Diploi can scaffold a new GitHub repo for your app. Create repository

  • Launch the stack: Click Launch Stack, and Diploi will provision the environment and boot your FastAPI app.
    Launch project

By launching your stack, Diploi will setup your app’s folder structure as a monorepository, which will be accessible online with a public URL, and it will also start a Remote Development environment, so you can start coding without the need of cloning the repository locally.

You can access the Remote Development environment via:

  • The browser IDE, Using the Browser IDE

  • Or your local editor by connecting by SSH.
    Using a local IDE

You can still develop locally if you prefer to run your application in your own environment, so you are not constrained to the Remote Development environment to create your application. FastAPI live preview


Launching FastAPI to Production

When your FastAPI application is ready to go live in a production environment, follow these steps:

  • Push your changes to GitHub: We recommend separate branches per stage of your app (e.g., Git Flow).

  • Open your project dashboard: In the Diploi console, navigate to your FastAPI project’s page. Project dashboard for your FastAPI app

  • Create a new deployment: Click Create Deployment + and choose Production for the stage.
    Launching a Production stage

  • Choose a cluster size: Select the resources that match your needs. We recommend that you start small, and scale later.
    Selecting a cluster size

  • Select the source branch: Pick the Git branch to deploy (e.g., main or prod).
    Selecting a branch

  • Configure environment variables: Add any variables that your API will need in production. FastAPI environment variables

  • Launch the deployment: Click Create Deployment to start up the production deployment.
    Creating the production deployment

Diploi will build and deploy a production-ready environment. Now, let’s add a custom domain.


Using a custom domain with your FastAPI app

As you might have noticed, Diploi gives your deployments a random .diploi.me subdomain. For example, your service might be reachable at my-app.diploi.me.

To use your own domain:

  • Open the Options tab: In your Production deployment, go to the Options tab from the deployment dashboard.
    Accessing the options of a deployment

  • Turn off generated endpoints: In Endpoints, disable Use Auto-Generated Endpoints to reveal the custom domain settings.

  • Add your hostname: Enable Use Custom Domain and enter the domain you will use, for example api.yourdomain.com or yourdomain.com.
    Adding a custom domain

  • Save the configuration: Scroll to the bottom and click Save Changes.

  • Configure your domain’s DNS settings: From your domain provider, you must create a new DNS CNAME record for the hostname you chose and point it to edge.diploi.com.

Once you modify your DNS settings, the update can take up to 30 minutes to propagate, but usually it is nearly instant.

Your FastAPI application will be available at your custom domain and SSL-protected automatically.


Just exploring FastAPI?

You can try FastAPI on Diploi in seconds without even registering an account. Here are two quick options to launch a playground to test-drive FastAPI:

  • Option 1 - Launch a trial without signing up Open the Diploi StackBuilder https://diploi.com/#StackBuilder and start a free trial project. Pick the FastAPI stack and click Launch. No account or credit card required and you get a temporary environment to explore.

  • Option 2 - Quick Launch with your Diploi account If you are logged in, create a new project and in the Repository section, choose Quick Launch instead of creating a GitHub repository. Diploi provisions a ready-to-use FastAPI app so you can experiment immediately.
    Quick launch

These options are great for testing and learning. For production, create a full project and repository. Remember FastAPI exposes interactive docs at /docs out of the box.


And that’s it! Now you should have a fresh deployment with FastAPI running. If you have questions, reach out on Discord or via email by messaging us at hello@diploi.com

Happy coding 👩‍💻


References

Get Started

Sign up using your GitHub account and receive 50 € in free credits to explore and experiment with. Development is about to get magical.

Sign Up