This guide will help you deploy API Zero to Hero to Render (free hosting) with zero DevOps experience needed.
Before deploying, make sure:
- You have a GitHub account (create one at https://github.com)
- You have pushed this code to a GitHub repository
- You have a Render account (free, no credit card needed)
Or manually go to: https://render.com/deploy
- Sign in to Render (create account if needed)
- Click "New +" → "Web Service"
- Connect your GitHub account
- Select your
apilabrepository - Click "Connect"
Render will auto-detect most settings from render.yaml, but verify:
| Setting | Value | Notes |
|---|---|---|
| Name | apilab or your choice |
This will be your URL |
| Region | Oregon (US West) | Or closest to you |
| Branch | main or master |
Your default branch |
| Runtime | Python 3 | Auto-detected |
| Build Command | pip install -r requirements.txt |
Auto-filled from render.yaml |
| Start Command | gunicorn wsgi:app --bind 0.0.0.0:$PORT --timeout 120 --workers 1 |
Auto-filled from render.yaml |
| Plan | Free | Select free tier |
These are automatically set from render.yaml:
- ✅
SECRET_KEY- Auto-generated secure random value - ✅
JWT_SECRET_KEY- Auto-generated secure random value - ✅
DATABASE_URL-sqlite:///instance/apilab.db - ✅
FLASK_ENV-production - ✅
PYTHON_VERSION-3.11.7
You don't need to add anything manually!
This ensures your database isn't deleted when the server restarts.
- Scroll down to Disks section
- Click "Add Disk"
- Configure:
- Name:
apilab-data - Mount Path:
/opt/render/project/instance - Size:
1 GB(free tier limit)
- Name:
- Click "Create Disk"
- Click "Create Web Service" button
- Wait 2-3 minutes for deployment
- Watch the logs - you should see:
==> Building... Installing dependencies from requirements.txt... ==> Build successful! ==> Starting server... ✅ Created instance directory ⚠️ Database is empty. Auto-seeding with default data... ✅ Database seeded successfully!
- Click the URL at the top (e.g.,
https://apilab-xyz.onrender.com) - You should see the API Zero to Hero dashboard
- Try logging in:
- Email:
testuser@apilab.dev - Password:
test123
- Email:
- Make a test request to
/api/todos
- Go to https://dashboard.render.com
- Click "New +" → "Web Service"
- Connect GitHub repository
- Fill in the form with these values:
Name: apilab
Region: Oregon (US West)
Branch: main
Runtime: Python 3
Build Command: pip install -r requirements.txt
Start Command: gunicorn wsgi:app --bind 0.0.0.0:$PORT --timeout 120 --workers 1Click "Advanced" → "Add Environment Variable" for each:
| Key | Value |
|---|---|
PYTHON_VERSION |
3.11.7 |
FLASK_ENV |
production |
DATABASE_URL |
sqlite:///instance/apilab.db |
For SECRET_KEY and JWT_SECRET_KEY, click "Generate" to create random values.
Under "Disks" section:
- Name:
apilab-data - Mount Path:
/opt/render/project/instance - Size:
1 GB
Click "Create Web Service" and wait for deployment.
Solution:
- Check logs in Render dashboard
- Look for errors in the build or start phase
- Common fixes:
- Make sure
requirements.txthas all dependencies - Verify
gunicornis inrequirements.txt - Check that
app.pyexists in root directory
- Make sure
Solution:
- Make sure you added the persistent disk
- Verify mount path is
/opt/render/project/instance - Check that
DATABASE_URLenv var points tosqlite:///instance/apilab.db
Solution:
- This is normal! Free tier apps sleep after 15 minutes
- First request takes ~30 seconds to wake up
- Just wait and refresh the page
Solution:
- Go to Render dashboard → Environment
- Add
SECRET_KEYandJWT_SECRET_KEYwith random values - Or use the "Generate" button in Render UI
Solution:
- Make sure persistent disk is mounted
- Check logs for "Created instance directory" message
- Verify database path in environment variables
Here's what Render does automatically:
- Clone your code from GitHub
- Install Python 3.11.7 (from
runtime.txt) - Install dependencies (from
requirements.txt) - Create instance folder (from
app/__init__.py) - Initialize database (SQLite, auto-created)
- Seed default data (2 users + 6 todos)
- Start gunicorn (binds to Render's assigned
$PORT) - Assign public URL (e.g.,
https://apilab-abc.onrender.com)
While this is a learning app, here are best practices:
- ✅ Secrets are auto-generated (not hardcoded)
- ✅ HTTPS is enforced by Render
- ✅ Environment variables are encrypted
⚠️ SQLite is fine for learning, but use PostgreSQL for real apps⚠️ Free tier sleeps after 15 min - upgrade for 24/7 availability
| Service | Free Tier | Paid Tier |
|---|---|---|
| Render | ✅ Free forever | $7/month (no sleep) |
| Railway | ✅ $5 free credit | $5/month usage-based |
| Heroku | ❌ No free tier | $7/month |
Recommendation for beginners: Start with Render's free tier!
After you push changes to GitHub:
- Render auto-deploys on every push to
mainbranch - Or manually click "Deploy latest commit" in Render dashboard
- Wait 1-2 minutes for rebuild
- Database data persists (thanks to disk mount)
- Check Render's logs: Dashboard → Your Service → Logs
- Read error messages carefully (they're usually helpful!)
- Search GitHub issues: https://github.com/yourusername/apilab/issues
- Create a new issue with your error logs
After deployment, verify:
- Homepage loads at your Render URL
- You can click "Playground" tab
- Login works with
testuser@apilab.dev/test123 - GET request to
/api/todosreturns data - Database tab shows 6 default todos
- You can create a new todo
- Reset button works
- Postman collection downloads
If all checked, you're live! 🎉
Remember: Render's free tier sleeps after 15 minutes of inactivity. This is normal! The first request after sleep takes ~30 seconds to wake up. Just bookmark your URL and visit periodically to keep it warm.
Happy Deploying! 🚀