Skip to content

Repository files navigation

SadPath

Not the happy path.

SadPath is an open-source automated chaos testing tool for websites. Enter a public URL, and a real Playwright browser probes your site for broken links, layout failures, JS errors, accessibility issues, and more — then Google Gemini AI generates a developer-focused report.

Live demo: shubhransh-gupta.github.io/SadPath
Repository: github.com/shubhransh-gupta/SadPath

Scanner AI License


Get Started

SETUP.md — full install, local run, deployment, and troubleshooting guide.

Quick local start:

git clone https://github.com/shubhransh-gupta/SadPath.git
cd SadPath
npm install
npx playwright install chromium
cp .env.example .env   # add GEMINI_API_KEY (optional)
npm run dev

Open http://localhost:5173 and click RUN SAD PATH.

Setup guide (web): /setup · SETUP.md


How It Works

URL → Playwright (real Chromium) → Structured scan data → Gemini AI → Sad path report
  1. You enter a URL on the frontend
  2. The backend launches headless Chromium via Playwright and visits your site
  3. Real test vectors run: viewport overflow, broken links, JS errors, axe-core accessibility, slow resources, broken images, long text injection, and more
  4. Scan data is sent to Google Gemini (free tier), which generates a personality-driven summary and fix recommendations
  5. Results stream live to the UI via Server-Sent Events (SSE)

Demo mode works instantly with simulated results. Live mode requires running the backend locally.


What Gets Scanned

Test What Playwright Does Severity
Broken Links HEAD-requests up to 8 same-origin links, reports 4xx/5xx Warning / Critical
Viewport Overflow Tests 320×480, 375×667, 768×1024, 1440×900, 2560×1080 for horizontal scroll Warning / Critical
JavaScript Errors Captures console errors and uncaught page exceptions Critical
Broken Images Detects images with 0×0 natural dimensions Warning
Slow Resources Flags resources taking >3s via Performance API Warning
Accessibility Runs axe-core (WCAG 2A/2AA) via @axe-core/playwright Critical / Warning / Notice
Long Text Injection Injects 200-char strings into inputs, checks layout breakage Warning
Missing Alt Text Finds <img> tags without alt attributes Notice
HTTP Status Reports if the main page returns 4xx/5xx Warning / Critical

Project Structure

SadPath/
├── src/                          # React frontend
├── server/                       # Express + Playwright backend
├── SETUP.md                      # Install & deploy guide
├── render.yaml                   # Render.com backend deploy
└── .github/workflows/deploy.yml  # GitHub Pages auto-deploy

API Reference

GET /api/scan/stream?url=<encoded-url>

Server-Sent Events stream with live progress and final results.

POST /api/scan

Non-streaming scan — returns full JSON when complete.

GET /api/scan/health

curl http://localhost:3001/api/scan/health

Deployment

Part Platform Cost
Frontend GitHub Pages Free
Backend Render / Fly.io / Oracle VM Free tier

See SETUP.md for step-by-step deployment instructions.


Security

  • Blocks localhost, private IPs, and internal hostnames (SSRF protection)
  • Only http:// and https:// protocols allowed
  • 45-second scan timeout, max 8 internal links per scan

⚠️ Only test websites you own or have explicit permission to test.


Tech Stack

Layer Technology
Frontend React 18, TypeScript, Vite, Tailwind CSS, Framer Motion
Backend Express, Playwright, @axe-core/playwright
AI Reports Google Gemini 2.0 Flash (free tier)
Streaming Server-Sent Events (SSE)

Contributing

See CONTRIBUTING.md.


License

MIT — see LICENSE.


Built for developers who don't trust happy paths.

Setup help? See SETUP.md · Questions? Open an issue

About

Automated chaos monkey for websites — find what breaks before your users do

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages