NOTE: I am the engineer behind the plithos platform as a service cloud project.

Hello everyone, today we are going to learn how to deploy a simple FastAPI application using Plithos. Plithos is a managed platform as a service provider that simplifies the process of software deployment to a huge degree. With Plithos, all we need to do is link a remote Git repository, and voila! Our entire application is up and ready, provided that we have a Dockerfile to specify how to build and run the application.

Step 1: Create an application

First, we need an application that we are going to deploy. For this example, we will use a basic FastAPI application with just three routes.

import os
from fastapi import FastAPI
app = FastAPI()
def read_root():
    return {"Hello": "World"}
def read_env():
    return {"env": os.environ.get("ENV_ENV", "World")}
def read_item(item_id: int, q: str = None):
    return {"item_id": item_id, "q": q}

The application is not complex at all; it contains three endpoints. The first endpoint returns a “Hello, World!” message. The second endpoint “/env” accesses an environment variable and returns its value as JSON. The third endpoint accesses path and query parameters and returns them.

In order to deploy our application, we will also need to specify a Dockerfile.

# Use the official Python 3.9 image as the base image for the container.
FROM python:3.9
# Set the working directory inside the container to /code.
# Copy the requirements.txt file from the local machine into the container's /code directory.
# This file lists the Python dependencies required for the FastAPI application.
COPY ./requirements.txt /code/requirements.txt
# Install the Python dependencies listed in the requirements.txt file.
# The "--no-cache-dir" flag ensures that pip doesn't use any cached data during installation.
# The "--upgrade" flag ensures that the latest versions of the dependencies are installed.
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the entire "app" directory from the local machine into the container's /code/app directory.
# This directory contains the file with the FastAPI application code.
COPY ./app /code/app
# Specify the default command to run when the container starts.
# It uses Uvicorn to run the FastAPI application.
# "app.main:app" points to the FastAPI application instance inside the "" file.
# "--host" binds the application to all available network interfaces so that it can be accessed externally.
# "--port 80" specifies the port on which the application will listen for incoming requests.
CMD ["uvicorn", "app.main:app", "--host", "", "--port", "80"]

If you want to see the project that we are deploying then visit this git repository.

Now that we have our application ready, let us move on to step 2.

Step 2: Create a new project

First, let’s create a new account and access our dashboard within Plithos. To do this, simply visit and sign up as usual. Then we can access the dashboard, which looks like this:

Plithos Dashboard

To create a new project, navigate to the “New Project” button as seen on the right side of the dashboard.

Plithos Add New Page

On this page, fill in some information about our software, such as the repository, branch, port information, authentication information, and so on.

I am going to select the “Personal Project” team and “1CPU & 500 MB RAM” resource constraints configuration, as this is what I require. Feel free to pick and choose as per your requirements. This is what my form looked like before I proceeded further.

Plithos new project filled up form

After filling up the form, press submit, and that’s it! Our application is now live on the internet.

Plithos dashboard: Project is live

If we check the details, we can see that we have a subdomain provided for us by the Plithos team. Accessing that domain will show our project live on the internet.

Plithos application details page
Application deployed on plithos platform

And that’s it! That’s all you need to do to deploy a FastAPI application on Plithos.

If you have any questions or need further assistance, feel free to ask. Happy deploying!