How to put a FastAPI API online
Normally, to open up your FastAPI API to the internet, you have to rent a VPS, install Python on it, figure out uvicorn, set up nginx as a proxy, issue and keep renewing an SSL certificate, and then make sure the process does not die after a reboot. For a pet project or your first service, that is hours of fiddling with things that have nothing to do with your actual code.
Netrun takes that infrastructure off your hands: you upload your code, the platform figures out on its own that it is a Python project, builds it, and hands you a public link with HTTPS. No server, no nginx, no manual certificate. Here is how to put your API online in a few minutes.
Put together requirements.txt
Add a requirements.txt file to the root of your project and list your dependencies in it — at minimum fastapi and uvicorn. uvicorn is the server that runs your async FastAPI app and accepts requests. Netrun uses this file to know what to install. You do not need to include a venv folder with the libraries themselves — the platform installs them for you.
Listen on the port from an environment variable
Start uvicorn so that it listens on host 0.0.0.0 and the port that Netrun passes through an environment variable (the platform forwards the right port for you). Do not hardcode the port as a number in your code — read it from the environment, for example via os.environ. That way your API becomes reachable at the link you are given.
Move secrets into environment variables
Do not keep third-party service keys, tokens, or your database connection string in your code — read them from environment variables. When you set up the project, Netrun asks for these values and injects them into the environment, so your secrets never end up in the repository or leak out with your code.
Upload your code to Netrun
Upload your project as a ZIP archive or import it from a GitHub repository, including a private one. Netrun detects that it is Python and builds the app automatically — you do not need to specify the language or write a Dockerfile. Build progress and logs are visible in your dashboard in real time.
Check the API and the auto-generated docs
When the build finishes, a public HTTPS link appears in your dashboard. FastAPI serves interactive auto-generated docs at /docs — open it in your browser to see every endpoint and send test requests right there. If the API responds, it is working.
That is it: your FastAPI API is online behind a secure link, with no server of your own and no nginx setup. On the Free plan a web app sleeps when idle and wakes on the first request — that first request is a little slower, but the project costs nothing while idle. If your API needs to respond instantly with no pauses, a paid plan with always-on running is a better fit. If something fails, Netrun restarts the project on its own, and the logs and status are always visible in your dashboard. Try Netrun.