Start here: complete step-by-step guides

FastAPI or Flask app: from first file to live, step by step

A minimal FastAPI (or Flask) app, requirements.txt, GitHub and the matching preset.

  1. Create a FastAPI app
  2. main.py
  3. Test and freeze
  4. Push, launch, configure
  5. Flask instead
  6. Go live on your domain
  7. Long jobs and bots

1. Create a FastAPI app

mkdir my-api && cd my-api
python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install fastapi "uvicorn[standard]" gunicorn

2. main.py

from fastapi import FastAPI

app = FastAPI()

@app.get('/')
def home():
    return {'message': 'Hello from Cloud Ninza'}

3. Test and freeze

uvicorn main:app --reload     # http://127.0.0.1:8000/docs
pip freeze > requirements.txt

4. Push, launch, configure

Push to GitHub. Launch an app → Python → plan → domain. App settings → Framework FastAPI / Starlette (ASGI) — the start command is gunicorn main:app -k uvicorn.workers.UvicornWorker …, so the file must be main.py and the object app. Add variables, Save all, connect Git deployments and Deploy now.

Flask instead

Name the file app.py with app = Flask(__name__), install flask gunicorn, freeze requirements, and choose the Flask preset (start gunicorn app:app …).

from flask import Flask
app = Flask(__name__)

@app.get('/')
def home():
    return 'Hello from Cloud Ninza'

Go live on your domain

Point the domain's @ and www A records to the IP shown in Domains, wait for Points here, then Issue free SSL → Always use HTTPS → Save changes.

Long jobs and bots

Requests should finish in seconds. For a Telegram/Discord bot or a script that runs on its own, choose the Python script / bot preset; for scheduled work use Cron jobs.

Stuck? Our engineers answer support tickets around the clock. Contact us, or create an account and open a ticket from the dashboard — the same guides are there too.

Next step

Move your site, or your whole cloud estate

Shared hosting you can buy in two minutes. Infrastructure and managed services quoted by an engineer within one business day.