Skip to main content

Deploy FastAPI on Hostim.dev

This guide shows how to deploy a FastAPI app on Hostim.dev from a Git repository.

Quick start: Use the "FastAPI Demo" template to skip the setup.

πŸ‘‰ Open the Console Click "+ New Project", pick FastAPI Demo, and you're good to go.

Want to customize or start fresh? Follow the steps below.


0. Create a Project​

  1. Open your Hostim.dev dashboard
  2. Click Create Project
  3. Choose one:
    • Scratch – start from zero
    • Template – select FastAPI Demo for a ready-made setup
    • Docker Compose – bring your own config
  4. Pick Scratch for this guide
  5. Name it (e.g., fastapi-demo) and click Create Project

1. Use the Example FastAPI App​

We'll use this public repo:

πŸ”— https://github.com/hostimdev/demo-fastapi

No need to clone unless you plan to run it locally. For local use, see its README.

🐳 Includes working Dockerfile and docker-compose.yml


2. Deploy on Hostim.dev​

⚠️ Create services in this order: Volume β†’ Postgres β†’ Redis β†’ App


2.1. Create a Volume for Uploads​

  1. Go to Create Service β†’ New Volume
  2. Name it uploads-data
  3. Pick a plan
  4. Click Create Volume

2.2. Add a PostgreSQL Database​

  1. Click Create Service β†’ New PostgreSQL
  2. Name it postgres
  3. Pick a plan
  4. Click Create PostgreSQL

2.3. Add a Redis Instance​

  1. Click Create Service β†’ New Redis
  2. Name it redis
  3. Pick a plan
  4. Click Create Redis

2.4. Create the FastAPI App​

  1. Click Create Service β†’ New App
  2. Choose Git as the deployment type
  3. Enter: https://github.com/hostimdev/demo-fastapi
  4. Branch: main
  5. Dockerfile path: leave as default
  6. Set your plan and replicas
  7. Attach the volume:
    • Volume: uploads-data
    • Mount path: /app/app/static/uploads
  8. Enable HTTP and set port to 8000
  9. Make it public (optional)
  10. Click Create App

2.5. Set Up Environment Variables​

Go to your app's Envs tab and add:

POSTGRES_USER=$(POSTGRES_POSTGRES_USER)
POSTGRES_PASSWORD=$(POSTGRES_POSTGRES_PASSWORD)
POSTGRES_DB=$(POSTGRES_POSTGRES_DATABASE)
POSTGRES_HOST=$(POSTGRES_POSTGRES_HOST)
POSTGRES_PORT=$(POSTGRES_POSTGRES_PORT)
REDIS_HOST=$(REDIS_REDIS_HOST)
REDIS_PORT=$(REDIS_REDIS_PORT)

These pull in values automatically from the other services you set up.

VariableDescription
POSTGRES_*Filled by PostgreSQL
REDIS_*Filled by Redis service

Click Save Changes when done.


βœ… Next Steps​