Skip to content

dixonsilveroff/auditlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” AuditLab

Automated website audit tool β€” transform any URL into a structured technical audit report in minutes.

AuditLab crawls your target website, captures screenshots, runs Lighthouse performance audits, and uses AI vision analysis to detect UI/UX issues β€” all from a single CLI command.


✨ Features

  • Smart Page Discovery β€” automatically detects homepage, service, and contact pages
  • Dual Viewport Screenshots β€” full-page captures at desktop (1280Γ—800) and mobile (375Γ—667)
  • Lighthouse Audits β€” Performance, Accessibility, and SEO scoring
  • AI Vision Analysis β€” Google Gemini detects layout, readability, CTA, and accessibility issues
  • Structured Reports β€” generates Markdown reports with embedded screenshots and issue breakdowns
  • Graceful Error Handling β€” retries failed pages, skips errors, and continues the pipeline

πŸ“¦ Installation

Prerequisites

  • Node.js v18 or higher
  • Google Chrome installed (for Lighthouse)
  • Gemini API key (optional, for AI vision analysis)

Setup

# Clone the repository
git clone https://github.com/dixonsilveroff/auditlab.git
cd auditlab

# Install dependencies
npm install

# Install Playwright's Chromium browser (~150MB download)
npx playwright install chromium

Environment Variables

Create a .env file in the project root:

# Required for AI vision analysis (optional β€” audits work without it)
GEMINI_API_KEY=your-gemini-api-key-here

# Vision model (optional β€” defaults to gemini-2.5-pro)
GEMINI_MODEL=gemini-2.5-pro

Get a free Gemini API key at aistudio.google.com/apikey.

Note: If no API key is set, AuditLab will skip vision analysis and still produce a report with Lighthouse scores and screenshots.


πŸš€ Usage

Basic Audit

node audit.js https://example.com

This will:

  1. Discover up to 3 key pages (homepage, service page, contact page)
  2. Capture desktop + mobile screenshots for each page
  3. Run Lighthouse audits on each page
  4. Perform AI vision analysis on each screenshot (if API key is set)
  5. Generate a Markdown report at ./outputs/example.com/report.md

CLI Options

node audit.js <url> [options]
Option Alias Default Description
--output <dir> -o ./outputs Custom output directory
--pages <n> -p 3 Maximum number of pages to audit
--help -h Show help
--version Show version

Examples

# Audit with custom output directory
node audit.js https://example.com --output ./reports

# Audit only the homepage
node audit.js https://example.com --pages 1

# Short flags
node audit.js https://example.com -o ./reports -p 2

# URL without protocol (https:// is added automatically)
node audit.js example.com

πŸ“‚ Output Structure

Each audit generates a directory under outputs/{domain}/:

outputs/example.com/
β”œβ”€β”€ report.md                              # The full Markdown audit report
β”œβ”€β”€ screenshots/
β”‚   β”œβ”€β”€ homepage-desktop.png               # Desktop screenshot
β”‚   β”œβ”€β”€ homepage-mobile.png                # Mobile screenshot  
β”‚   β”œβ”€β”€ contact-desktop.png
β”‚   β”œβ”€β”€ contact-mobile.png
β”‚   β”œβ”€β”€ services-desktop.png
β”‚   └── services-mobile.png
└── lighthouse/
    β”œβ”€β”€ homepage.json                      # Raw Lighthouse data
    β”œβ”€β”€ contact.json
    └── services.json

Report Sections

The generated report.md includes:

  1. Executive Summary β€” issue counts by severity (High / Medium / Low)
  2. Lighthouse Scores β€” Performance, Accessibility, and SEO scores per page
  3. Key Issues β€” all detected issues with severity, source, and recommendations
  4. Page Breakdown β€” per-page details with screenshots, scores, and issues

πŸ€– Vision Analysis

When a GEMINI_API_KEY is configured, AuditLab sends desktop screenshots to Google Gemini for automated UI/UX analysis.

What It Detects

Category Examples
Layout Issues Broken layouts, overlapping elements, excessive whitespace
Readability Poor contrast, tiny text, missing visual hierarchy
CTA Issues Missing calls-to-action, unclear buttons, poor placement
Responsiveness Mobile layout problems, overflow issues
Accessibility Missing alt text indicators, poor color contrast

Issue Format

Each issue includes:

  • Issue β€” concise description of the problem
  • Severity β€” High (blocks usability), Medium (degrades UX), Low (cosmetic)
  • Recommendation β€” specific, actionable fix

Changing the Vision Model

Update GEMINI_MODEL in your .env file. Available vision-capable models:

Model Speed Quality Cost
gemini-2.5-flash ⚑ Fast Good Low
gemini-2.5-pro 🐒 Slower Best Higher
gemini-1.5-flash ⚑ Fast Good Low
gemini-1.5-pro 🐒 Slower Great Medium

Browse all models at ai.google.dev/gemini-api/docs/models.


πŸ—οΈ Architecture

audit.js                  CLI entry point & pipeline orchestrator
  β”‚
  β”œβ”€β”€ src/crawler.js      Page discovery (keyword matching + fallback)
  β”œβ”€β”€ src/browser.js      Playwright browser lifecycle
  β”œβ”€β”€ src/screenshot.js   Dual-viewport screenshot capture
  β”œβ”€β”€ src/lighthouse.js   Lighthouse audit runner (via chrome-launcher)
  β”œβ”€β”€ src/vision.js       Google Gemini vision analysis
  β”œβ”€β”€ src/aggregator.js   Issue merging & deduplication
  └── src/report.js       Markdown report generator

Pipeline Flow

URL β†’ Discover Pages β†’ Capture Screenshots β†’ Run Lighthouse β†’ Vision Analysis β†’ Aggregate Issues β†’ Generate Report

All steps are sequential. Failed pages are skipped and the pipeline continues.


⚠️ Troubleshooting

Problem Solution
Error: Chromium not found Run npx playwright install chromium
Vision: 404 model not found Update GEMINI_MODEL in .env (check available models)
Vision: No API key set Add GEMINI_API_KEY to your .env file
Lighthouse timeout The target site may be slow β€” audit will continue with other pages
Screenshots are blank Some JS-heavy sites need longer load times β€” try again

πŸ“‹ Limitations

  • Audits up to 3 pages per run (configurable via --pages)
  • Vision analysis may have minor inaccuracies
  • Sites behind authentication are not supported
  • Very large or JS-heavy SPAs may have incomplete screenshots

πŸ›£οΈ Roadmap

  • Full site crawling
  • Web dashboard UI
  • Batch processing (multiple URLs)
  • PDF report export
  • Historical comparison (track scores over time)

πŸ“„ License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors