🚀 Deployment Guide (Free & Lifetime)
This guide will show you how to deploy your Web Scraper API to Render.com for free. Render is an excellent cloud platform that supports Python and Playwright out of the box.
✅ Prerequisites
- GitHub Account: You need a GitHub account to host your code.
- Git Installed: You must have Git installed on your computer.
Step 1: Push Code to GitHub
First, we need to get your code onto GitHub.
Log in to GitHub and create a New Repository.
- Name it something like
Alt-scraper-api. - Make it Public or Private (Private is fine).
- Do not initialize with a README (we have code locally).
- Name it something like
Open your terminal in the project folder (
d:\webscreper) and run these commands one by one:# Initialize git git init # Add all files git add . # Commit changes git commit -m "Initial commit for deployment" # Link to your new GitHub repo (Replace YOUR_USERNAME and REPO_NAME) git remote add origin https://github.com/YOUR_USERNAME/Alt-scraper-api.git # Push code git push -u origin main
Step 2: Create a Web Service on Render
- Go to dashboard.render.com and sign up/log in.
- Click the "New +" button and select "Web Service".
- Connect your GitHub account.
- Find your
Alt-scraper-apirepository and click "Connect".
Step 3: Configure the Service
Fill in the details exactly as follows to ensure it works with Flask and Playwright:
- Name:
Alt-scraper(or whatever you like) - Region: Closest to you (e.g., Frankfurt or Oregon)
- Branch:
master - Root Directory: (Leave blank)
- Runtime: Python 3
- Build Command:
./build.sh - Start Command:
uvicorn api:app --host 0.0.0.0 --port $PORT --interface wsgi --workers 4 --timeout-keep-alive 600 - Instance Type: Select Free
⚠️ crucial: Environment Variables
Scroll down to "Advanced" or "Environment Variables" and make sure these settings are correct. We already set up the build.sh script to handle dependencies, so this part should be automatic.
Step 4: Deploy
- Click "Create Web Service".
- Render will start building your app. You can watch the logs.
- It will install Python dependencies.
- It will install Chromium (for Playwright).
- Once finished, you will see a green checkmark "Live".
- Copy your URL (e.g.,
https://Alt-scraper.onrender.com).
Step 5: Test Your API
Now you can use this URL in Postman instead of 127.0.0.1:5050.
New Request:
- Method:
GET - URL:
https://YOUR-APP-NAME.onrender.com/api/seo-report?domain=https://example.com
ℹ️ Important Notes about "Free" Tier
- Spin Down: The free instance "sleeps" after 15 minutes of inactivity. The first request after sleeping might take 30-50 seconds to wake it up. This is normal.
- Keep Alive (Optional): If you want it to stay awake, you can use a free "Uptime Monitor" (like UptimeRobot) to ping your API every 10 minutes.
You now have a fully functional, free, lifetime deployment of your scraper! 🚀