Menu

Deploy FastAPI and a React app on a VPS with nginx, systemd and uv
📰

Deploy FastAPI and a React app on a VPS with nginx, systemd and uv

DEV Community: fastapi·Aravind Govindhasamy·2 days ago
#jyhRdoqr
#devtofastapi#devto#dev#example#sudo
Reading 0:00
15s threshold

A single small VPS (or a home server) runs a FastAPI + React app comfortably. No containers needed: the frontend is static files, the API is one Python process under systemd, and nginx sits in front of both.

What you need

An Ubuntu server (22.04 or newer) you can SSH into

A domain with two DNS records pointing at the server: example.com (the site) and api.example.com (the API)

Your app's code, with the backend managed by uv

1. Prepare the server

sudo apt update && sudo apt install -y nginx curl -LsSf https://astral.sh/uv/install.sh | sh # installs uv for your user

Enter fullscreen mode

Exit fullscreen mode

Open only what you need with the firewall:

sudo ufw allow OpenSSH && sudo ufw allow 'Nginx Full' && sudo ufw enable

Enter fullscreen mode

Exit fullscreen mode

2.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.