# 🚀 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 1. **GitHub Account**: You need a GitHub account to host your code. 2. **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. 1. **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). 2. **Open your terminal** in the project folder (`d:\webscreper`) and run these commands one by one: ```bash # 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 1. Go to [dashboard.render.com](https://dashboard.render.com) and sign up/log in. 2. Click the **"New +"** button and select **"Web Service"**. 3. Connect your **GitHub** account. 4. Find your `Alt-scraper-api` repository 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**: ```bash ./build.sh ``` * **Start Command**: ```bash 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 1. Click **"Create Web Service"**. 2. Render will start building your app. You can watch the logs. * It will install Python dependencies. * It will install Chromium (for Playwright). 3. Once finished, you will see a green checkmark **"Live"**. 4. 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 1. **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. 2. **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! 🚀