DEV Community

Fiyinfoluwa Ojo
Fiyinfoluwa Ojo

Posted on

Deploying a FastAPI App to Render: Taking Your API Live

From Local to Live

Running an API on localhost is great for development.
But a real backend needs to be accessible to the world.
Today I deployed my FastAPI app to Render.

Why Render?

  • Free tier available
  • Connects directly to GitHub
  • Auto-deploys on every push to main
  • Environment variables built in
  • Zero server configuration

The Setup

3 files needed for deployment:

1. requirements.txt

fastapi==0.129.0
uvicorn==0.41.0
sqlalchemy==2.0.41
pydantic==2.11.5
bcrypt==4.3.0
pyjwt==2.10.1
python-dotenv==1.1.0
Enter fullscreen mode Exit fullscreen mode

2. .python-version

3.11.0

This pins the Python version- critical because
newer versions can break dependencies.

3. Start Command

uvicorn main:app --host 0.0.0.0 --port $PORT

$PORT is automatically provided by Render.

Environment Variables on Render

Never hardcode secrets in your code.
Set them in Render's dashboard under Environment:

  • SECRET_KEY
  • ALGORITHM
  • DATABASE_URL

The Live API

Live api browser

signup postman

Live URL: https://gdgoc-bowen-api.onrender.com

Lessons Learned

Deployment is not the scary part, it's just
connecting your GitHub repo to a platform and
setting your environment variables correctly.
The hard work is writing production-ready code.

Day 20 done. 10 more to go.

GDGoCBowen30dayChallenge

Top comments (0)