About FastAPI
FastAPI turns Python type hints into an HTTP API. Pydantic validates input against them, Starlette handles the web layer, and every route appears in an OpenAPI schema with interactive docs at /docs. The framework is MIT-licensed.
APIs live on fast cores. A Cloud VPS on AMD EPYC suits most services; a High Frequency VPS at 4.2 GHz+ helps when requests do heavy Python work. Hourly billing keeps throwaway staging servers cheap.
The server boots on Ubuntu 24.04 LTS with Python and FastAPI installed; root SSH lets you arrange the rest your way.
What you get with FastAPI
- Validation and serialization from type hints via Pydantic
- Swagger UI at
/docsand ReDoc at/redoc - Sync and
asynchandlers in the same app - Dependency injection for auth, sessions and settings
fastapi devwith reload,fastapi runfor production
FastAPI use cases
- Backends for web and mobile apps
- A small HTTP endpoint in front of a machine learning model
- Internal microservices and webhook receivers
After you deploy FastAPI
- Once the console lists the server as Running, log in as root with the Access tab password or the key you added.
- Create a project with its own virtual environment and install
fastapi[standard]inside it. - Run
fastapi run main.py: it binds port 8000 on all interfaces, andhttp://<server IP>:8000/docsshows the live docs. - Keep it alive with a systemd unit and put Nginx or Caddy with HTTPS in front before going public.
FastAPI ports
Open these in your firewall if you use one: 8000/tcp fastapi run, 80/tcp HTTP proxy, 443/tcp HTTPS proxy.
FastAPI FAQ
Should port 8000 face the internet?
Only while testing. In production, let Nginx or Caddy terminate HTTPS on 443, allow only 22, 80 and 443 in a CloudSat firewall, and use --workers for more processes.
Which plan fits a FastAPI service?
A small API with an external database runs well on 1 GB. Each worker adds memory and in-process models add far more, so inference endpoints often start at 4 GB ($11.58/mo).
Disclaimer. The FastAPI project has no affiliation with CloudSat and does not endorse it. Names and logos belong to their owners and appear only to identify the software.