Complete instructions to download, run locally, deploy, and connect the frontend and backend.
Repository: github.com/shubhransh-gupta/SadPath
Web setup guide: shubhransh-gupta.github.io/SadPath/setup
- Prerequisites
- Local Setup
- Environment Variables
- Available Scripts
- Deployment Overview
- Frontend → GitHub Pages
- Backend → Render (Free)
- Other Free Backend Options
- Connect Frontend to Backend
- Troubleshooting
| Requirement | Version |
|---|---|
| Node.js | 18+ (20 recommended) |
| npm | 9+ |
| Git | Any recent version |
| Chromium | Installed via Playwright (see below) |
| Gemini API key | Optional but recommended (free) |
OS notes:
- macOS, Linux, and Windows are supported
- Playwright downloads its own Chromium binary — you do not need Chrome installed separately
git clone https://github.com/shubhransh-gupta/SadPath.git
cd SadPathnpm installThis also runs npx playwright install chromium automatically. If it fails, run manually:
npx playwright install chromiumOn Linux servers you may also need:
npx playwright install-deps chromiumcp .env.example .envEdit .env and add your Gemini API key (optional):
GEMINI_API_KEY=your_key_hereGet a free key at Google AI Studio.
Without a Gemini key, scans still work — you get real issues with rule-based summaries instead of AI-generated ones.
npm run dev| Service | URL |
|---|---|
| Frontend | http://localhost:5173 |
| Backend API | http://localhost:3001 |
| Health check | http://localhost:3001/api/scan/health |
Open the frontend, enter any public URL (e.g. https://example.com), and click 💥 RUN SAD PATH.
# Terminal 1 — backend
npm run dev:server
# Terminal 2 — frontend
npm run dev:webIn local dev, the Vite dev server proxies /api requests to localhost:3001 — no VITE_API_URL needed.
# Health check
curl http://localhost:3001/api/scan/health
# Run a test scan
curl -N "http://localhost:3001/api/scan/stream?url=https://example.com"Copy .env.example to .env and configure:
| Variable | Required | Default | Description |
|---|---|---|---|
PORT |
No | 3001 |
Backend API port |
GEMINI_API_KEY |
No | — | Google Gemini API key for AI reports |
FRONTEND_URL |
No | — | Allowed CORS origin in production |
VITE_API_URL |
No | "" |
Backend URL for production frontend builds |
GITHUB_PAGES |
No | — | Set to true when building for GitHub Pages |
SKIP_PLAYWRIGHT |
No | — | Set to 1 to skip Chromium install (CI only) |
Local development: only GEMINI_API_KEY is needed (optional).
Production frontend: set VITE_API_URL=https://your-backend.onrender.com
Production backend: set GEMINI_API_KEY and FRONTEND_URL
| Command | Description |
|---|---|
npm run dev |
Start frontend + backend together |
npm run dev:web |
Frontend only (Vite dev server) |
npm run dev:server |
Backend only (compiles + watches server) |
npm run build |
Build frontend for production |
npm run build:server |
Compile backend TypeScript |
npm run start:server |
Run compiled backend (production) |
npm run preview |
Preview production frontend build |
SadPath is split into two parts:
| Part | Hosts On | Cost |
|---|---|---|
| Frontend (React UI) | GitHub Pages | Free |
| Backend (Playwright API) | Render / Fly.io / Oracle VM | Free tier available |
The frontend cannot scan websites by itself — it needs the backend running somewhere.
GitHub Pages (frontend) → VITE_API_URL → Render/Fly.io (backend)
GitHub Pages deployment is automatic on every push to main.
- Fork or clone this repo to your GitHub account
- Go to Settings → Pages → Build and deployment
- Set source to GitHub Actions
- Push to
main— the workflow in.github/workflows/deploy.ymldeploys automatically
Your site will be at:
https://<your-username>.github.io/SadPath/
- Go to Settings → Secrets and variables → Actions
- Add secret:
VITE_API_URL=https://your-backend.onrender.com - Re-run the deploy workflow (Actions → Deploy to GitHub Pages → Run workflow)
Render offers a free web service tier — the easiest way to host the backend.
- Push this repo to GitHub
- Sign up at render.com
- Click New → Blueprint
- Connect your GitHub repo — Render reads
render.yamlautomatically - Set environment variables in the Render dashboard:
GEMINI_API_KEY— your Gemini API keyFRONTEND_URL— your GitHub Pages URL (e.g.https://your-username.github.io)
- Click Deploy
Render will run:
npm install && npx playwright install chromium && npm run build:server
node server/dist/index.jsYour API will be at something like:
https://sadpath-api.onrender.com
Note: Render free tier spins down after 15 minutes of inactivity. First request after idle may take 30–60 seconds (cold start). Playwright + Chromium uses ~512 MB RAM — sufficient for most scans.
| Platform | Free Tier | Playwright Support | Best For |
|---|---|---|---|
| Render | 750 hrs/month | ✅ Good | Easiest setup (uses render.yaml) |
| Fly.io | 3 shared VMs | ✅ Good | More RAM control via Docker |
| Oracle Cloud | Always-free VM (24 GB RAM) | ✅ Excellent | Always-on, no spin-down |
| Railway | Trial credits only | ✅ Good | Quick testing |
| Vercel / Netlify | ❌ | No | Serverless — Chromium too heavy |
| GitHub Pages | ✅ | ❌ | Frontend only |
Create a Dockerfile in the repo root:
FROM mcr.microsoft.com/playwright:v1.49.1-noble
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build:server
EXPOSE 3001
CMD ["node", "server/dist/index.js"]Deploy:
fly launch
fly secrets set GEMINI_API_KEY=your_key
fly deploy- Create an ARM VM (Ubuntu 22.04) on Oracle Cloud Free Tier
- SSH in and install Node.js 20
- Clone repo, run
npm install && npx playwright install chromium - Build and start:
npm run build:server && npm run start:server - Use PM2 to keep running:
pm2 start server/dist/index.js - Point a domain or use the public IP with nginx reverse proxy
After deploying both parts:
| Step | Action |
|---|---|
| 1 | Deploy backend to Render (or Fly.io / Oracle VM) |
| 2 | Copy backend URL (e.g. https://sadpath-api.onrender.com) |
| 3 | Add GitHub secret VITE_API_URL with that URL |
| 4 | Re-run GitHub Pages deploy workflow |
| 5 | Set FRONTEND_URL on backend to your GitHub Pages URL |
# Backend health
curl https://your-api.onrender.com/api/scan/health
# Test scan
curl -N "https://your-api.onrender.com/api/scan/stream?url=https://example.com"Open your GitHub Pages URL, enter a public website, and click 💥 RUN SAD PATH.
The frontend cannot reach the backend.
# Check if backend is running
curl http://localhost:3001/api/scan/health
# Start backend
npm run dev:serverFor production: verify VITE_API_URL is set correctly in GitHub secrets.
Chromium is not installed.
npx playwright install chromium
npx playwright install-deps chromium # Linux onlyNormal on Render free tier. The service spins down after inactivity. First scan after idle waits for the server to wake up.
Check that GEMINI_API_KEY is set:
# Local
cat .env | grep GEMINI
# Render: Dashboard → your service → Environment → GEMINI_API_KEYHealth check shows AI status:
curl http://localhost:3001/api/scan/health
# "ai": "gemini-configured" ← key is set
# "ai": "fallback-mode" ← no key, rule-based summaries onlySet FRONTEND_URL on the backend to match your GitHub Pages URL exactly:
FRONTEND_URL=https://your-username.github.ioEnsure GITHUB_PAGES=true is set during build (already configured in the workflow). Your site URL must include /SadPath/ path unless you rename the repo to <username>.github.io.
Change the backend port in .env:
PORT=3002Update vite.config.ts proxy target if running locally.
Back to README · Questions? Open an issue