- FastAPI
- Uvicorn
- NGINX
- systemd
FastAPI VPS HostingA production API server, not a dev server
FastAPI's own docs say to serve production with fastapi run or Uvicorn, not the reload server. We set up Python, a systemd service for Uvicorn, NGINX with free SSL and a database on a hardened KVM VPS. You deploy your app and go live.
- KVM virtualisation
- NVMe storage
- Root SSH access
- Free one-time setup
- 99.9% uptime SLA
$systemctl list-units --type=service --state=active
- nginxHTTPS reverse proxy
- myapiUvicorn running your FastAPI app
- postgresqldatabase server
- ufwfirewall: 22, 80, 443
- fail2banSSH brute-force guard
- unattended-upgradessecurity updates
Installed and secured before handover.
Why Run FastAPI on a VPS
Serverless and free tiers add cold starts and limits. A VPS gives your API a process that stays up and a database next to it.
Always warm
Your workers are already running when the first request arrives.
Real concurrency
Uvicorn's workers use multiple cores: the docs' --workers option starts one process per worker.
Any database and cache
PostgreSQL, MySQL or Redis on the same server, or external.
Flat cost
One server cost, however many requests you serve.
How a FastAPI Server Is Set Up
NGINX at the edge, Uvicorn running your app behind it.
-
Reverse proxy
NGINX
HTTPS on your domain, forwarding requests to Uvicorn on localhost.
-
Application server
Uvicorn (uvicorn[standard])
Runs your FastAPI app as a systemd service; the standard extra adds uvloop.
-
Application
Your FastAPI project
Deployed into a virtual environment with its own settings and secrets.
-
Database
PostgreSQL (optional)
A database and user for your API, reachable only from the server.
Engineer's notes
- FastAPI's docs: fastapi run is the command to serve in production; --reload is for development only.
- Uvicorn takes --workers N to start N worker processes and use several cores.
- Keep Uvicorn on 127.0.0.1 and let NGINX face the internet.
- Each worker is a full copy of your app in memory: size workers to your RAM.
- 443HTTPS, NGINX
- 80HTTP, redirects to HTTPS
- 22SSH, you only
- 8000Uvicorn, localhost only
What You Can Run
A REST or JSON API
The classic FastAPI service behind NGINX.
An ML model endpoint
A small model served over HTTP (mind the CPU-only plans).
Webhook receivers
Endpoints for payment, chat and CI callbacks.
A backend for a mobile app
Auth, data and push logic.
Background workers
Queues and scheduled jobs beside the API.
A staging copy
A second app on the same server for testing.
Which Plan for Your FastAPI App
Workers, libraries and the database share the server memory.
VPS-1
2 vCores and 4 GB RAM; two workers fit comfortably.
A starting point, not a limit: every plan upgrades in place, keeping your data, IP address and configuration.
Deploying Your FastAPI App
A first deployment, as your own user. Replace the names with yours.
-
Create the environment and install packages
Include uvicorn[standard] for the faster event loop.
python3 -m venv .venv.venv/bin/pip install -r requirements.txt "uvicorn[standard]" -
Try it by hand
Bind to localhost; main:app is module:variable.
.venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000 -
Use several workers
One worker process per core is a common start.
.venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --workers 2 -
Run it as a service
A systemd unit whose ExecStart is the command above, with Restart=on-failure.
sudo systemctl daemon-reloadsudo systemctl enable --now myapi -
Check it end to end
Through NGINX and HTTPS.
curl -I https://api.example.com/docs
Example commands: adjust names, paths and versions to your project. Deploying and maintaining your application is yours to do, or ask us for a quote.
FastAPI commands you will use every week
Copy, paste, adjust the names. Each one is safe to run as your own user on the server.
Restart the API
sudo systemctl restart myapi
Follow the log
sudo journalctl -u myapi -f
Is it listening?
ss -ltnp | grep 8000
Update packages
.venv/bin/pip install -U -r requirements.txt
Reload NGINX safely
sudo nginx -t && sudo systemctl reload nginx
Memory per worker
ps -o pid,rss,cmd -C uvicorn
Serverless or FastAPI on a VPS?
Serverless scales to zero. A VPS stays warm at a flat cost.
Serverless platform
- Cold startsPossible after idle time
- PricingPer request and per second
- Long jobs and connectionsTime limits apply
- DatabaseSeparate service and latency
- Server administrationHandled by the platform
FastAPI VPS
- Cold startsNone: the process stays running
- PricingFlat server cost
- Long jobs and connectionsNo platform time limit
- DatabaseOn the same server
- Server administrationYours, after our free setup
Your FastAPI stack
Free one-time setup before you get access. Here is what happens, and what you receive.
Pick a plan and a location
Resources that fit your workload, in the datacentre closest to your users.
Tell us your FastAPI setup
Versions, database and domain: at order or right after.
We install and secure it
Server hardened, the stack installed and tested, HTTPS on your domain.
You get root
SSH to a working server, ready for your code and data.
Installed for you
- Python 3 with venv and pip, or the version you specify
- A systemd service for Uvicorn running your app
- NGINX reverse proxy with HTTPS on your domain
- PostgreSQL or MySQL with a database and user, on request
- Your FastAPI code and secrets are deployed by you
Secured before handover
- Non-root sudo user created for daily work
- SSH key login, password login for root disabled
- Firewall (UFW) open only for the ports you use
- Fail2ban blocking repeated login attempts
- Automatic security updates enabled
- Free Let's Encrypt SSL on your domain
- Timezone, swap and hostname configured
Not included (we say so up front)
- Ongoing server administration
- Application maintenance and updates
- Debugging your code
- Migrating existing sites or data
Security and Performance for FastAPI
Security
- Never run with --reload in production; the docs warn it costs resources and stability.
- Keep secrets in environment variables, not in the repository.
- Bind Uvicorn to localhost and let NGINX terminate HTTPS.
- Keep Python packages updated; security fixes land often.
Performance
- Size --workers to your cores and RAM, then load-test.
- Install uvicorn[standard] for uvloop.
- Use a connection pool for the database.
- Cache expensive responses with Redis.
Built from the official documentation
VPS Plans for FastAPI
VPS-1 runs a small API with a database. Choose VPS-2 or above for several workers, heavier libraries or a busier database.
VPS-1
Small websites, APIs, bots and development servers.
- 2 vCores
- 4 GB RAM
- 40 GB NVMe
- 500 Mbps
- Full root and SSH access
- Free initial stack installation
- Server hardening and firewall setup
- Daily backup of the previous 24 hours
- Unlimited traffic *
- Anti-DDoS protection
- Dedicated IPv4 and IPv6
- KVM virtualisation
VPS-2
Production apps, WordPress and online stores.
- 4 vCores
- 8 GB RAM
- 75 GB NVMe
- 1 Gbps
- Full root and SSH access
- Free initial stack installation
- Server hardening and firewall setup
- Daily backup of the previous 24 hours
- Unlimited traffic *
- Anti-DDoS protection
- Dedicated IPv4 and IPv6
- KVM virtualisation
VPS-3
Busy stores, SaaS products and several projects.
- 6 vCores
- 12 GB RAM
- 100 GB NVMe
- 2 Gbps
- Full root and SSH access
- Free initial stack installation
- Server hardening and firewall setup
- Daily backup of the previous 24 hours
- Unlimited traffic *
- Anti-DDoS protection
- Dedicated IPv4 and IPv6
- KVM virtualisation
VPS-4
High-traffic apps, large databases and agencies.
- 8 vCores
- 24 GB RAM
- 200 GB NVMe
- 3 Gbps
- Full root and SSH access
- Free initial stack installation
- Server hardening and firewall setup
- Daily backup of the previous 24 hours
- Unlimited traffic *
- Anti-DDoS protection
- Dedicated IPv4 and IPv6
- KVM virtualisation
* Unlimited traffic in Europe and North America. In Mumbai, Singapore and Sydney a monthly allowance applies (VPS-1 500 GB, VPS-2/VPS-3 1 TB, VPS-4 3 TB), then speed is limited to 10 Mbps until the next month.
Prices exclude 18% GST, which is added to invoices for customers in India.
Platform specs and locations
The same KVM platform on every plan; only CPU, RAM, storage and port speed change.
- Virtualisation
- KVM with reserved vCores and RAM
- Storage
- NVMe SSD on every plan
- Network
- Dedicated IPv4 and IPv6, 500 Mbps to 3 Gbps per plan
- Operating systems
- Ubuntu 26.04, 24.04 and 22.04 LTS · Debian 13, 12 and 11 · AlmaLinux · Rocky Linux · Fedora · FreeBSD
- Access
- Full root over SSH, key-based login
- Backups
- Automatic daily backup of the previous 24 hours; snapshots and longer retention on request
- Protection
- Always-on anti-DDoS mitigation
- Availability
- 99.9% uptime SLA
Asia-Pacific
- Mumbai
- Singapore
- Sydney
Europe
- London
- Limburg
- Roubaix
- Gravelines
- Strasbourg
- Milan
- Warsaw
North America
- Beauharnois
Availability per location changes with demand; we confirm your location before setup. In Mumbai, Singapore and Sydney each plan includes a monthly traffic allowance (VPS-1 500 GB, VPS-2 and VPS-3 1 TB, VPS-4 3 TB); beyond it, speed is limited to 10 Mbps until the next month.
Questions before you deploy
Not covered here? Ask an engineer before you order.
Ready when you are
Put Your FastAPI App Live
Choose a plan and we hand over Python, Uvicorn, NGINX and HTTPS on a hardened server, ready for your code.