# πŸ” Website Monitoring Platform Full-stack website monitoring platform that uses **Google Lighthouse** to audit performance, SEO, accessibility, and best practices β€” with real-time progress tracking, team collaboration, and alerting. ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Website Monitoring β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Frontend │───▢│ Backend │───▢│ PostgreSQL (DB) β”‚ β”‚ β”‚ β”‚ Next.js β”‚ β”‚ Express β”‚ β”‚ via Supabase β”‚ β”‚ β”‚ β”‚ Port 3000 │◀───│ Port 5000β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚Lighthouseβ”‚ β”‚ β”‚ └─── SSE ──│ + Chrome β”‚ β”‚ β”‚ (progress) β”‚ Headless β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## ✨ Features | Feature | Status | Description | |---------|--------|-------------| | **Lighthouse Audits** | βœ… Real | Performance, SEO, accessibility, best practices scores | | **Real-time Progress** | βœ… Real | Server-Sent Events stream during scans | | **Dashboard** | βœ… Real | Overview with charts, metrics, and website list | | **Performance Monitoring** | βœ… Real | Track scores over time with Recharts | | **SEO Analysis** | βœ… Real | SEO score tracking and recommendations | | **Uptime Monitoring** | βœ… Real | HTTP HEAD checks every 5 min, response time + SSL tracking | | **Alert Engine** | βœ… Real | Evaluates scans against thresholds, auto-resolves on recovery | | **Notifications** | βœ… Real | Email (Resend) + webhook delivery with debouncing | | **Admin Dashboard** | βœ… Real | System stats, user CRUD, org management (role-protected) | | **Billing & Usage** | βœ… Real | 4 tiers (free/starter/pro/enterprise), usage bars, limit enforcement | | **Competitor Analysis** | βœ… Real | Lighthouse comparison + response time benchmarking | | **Team/Organization** | βœ… Real | Multi-user orgs with 4-level RBAC | | **Authentication** | βœ… Real | Supabase Auth (email, OAuth) | | **Scheduled Scans** | βœ… Real | Cron-based Lighthouse scans (6h) + uptime checks (5min) | | **Website Crawler** | βœ… Real | Crawl and discover pages on your websites | ## πŸ›  Tech Stack | Layer | Technology | Cost | |-------|-----------|------| | Frontend | Next.js 15, React 19, TypeScript, Tailwind CSS 4, Shadcn/UI | Free | | Backend | Express.js, TypeScript, Node.js 18+ | Free | | Database | PostgreSQL via Supabase | Free tier | | Auth | Supabase Auth | Free tier | | Auditing | Google Lighthouse + Headless Chrome | Free (OSS) | | Charts | Recharts + Chart.js | Free (OSS) | | CI/CD | GitHub Actions | Free (public repos) | | Containers | Docker + Docker Compose | Free | | Linting | ESLint + Prettier | Free (OSS) | | Testing | Jest + Supertest + Testing Library | Free (OSS) | | Email | Resend | Free tier (3000/mo) | | Pre-commit | Husky | Free (OSS) | ## πŸš€ Quick Start ### Prerequisites - Node.js 18+ - npm - Docker & Docker Compose (for full stack) - Supabase account (free tier) ### Option 1: Local Development ```bash # Clone the repo git clone cd website-monitoring # Install root dependencies (Husky, concurrently) npm install # Setup backend cd website-monitoring-backend cp .env.example .env npm install npm run build cd .. # Setup frontend cd website-monitoring-frontend cp .env.example .env # Fill in your Supabase keys npm install cd .. # Run everything npm run dev ``` ### Option 2: Docker Compose ```bash # Copy and fill in environment variables cp .env.example .env # Start all services npm run docker:up # Access at http://localhost:3000 ``` ## πŸ“ Project Structure ``` website-monitoring/ β”œβ”€β”€ website-monitoring-backend/ # Express.js API + Lighthouse engine β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ index.ts # Server entry, health check, routing β”‚ β”‚ └── routes/ β”‚ β”‚ └── lighthouse.ts # Lighthouse audit + SSE progress β”‚ β”œβ”€β”€ Dockerfile β”‚ └── package.json β”‚ β”œβ”€β”€ website-monitoring-frontend/ # Next.js 15 dashboard β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ app/ # Pages & API routes (20+ endpoints) β”‚ β”‚ β”œβ”€β”€ components/ # React components (dashboard, UI, auth) β”‚ β”‚ β”œβ”€β”€ services/ # Business logic (scanning, monitoring) β”‚ β”‚ └── types/ # TypeScript type definitions β”‚ β”œβ”€β”€ Dockerfile β”‚ └── package.json β”‚ β”œβ”€β”€ website-monitoring-devops/ # Infrastructure β”‚ β”œβ”€β”€ docker-compose.yml # Full stack orchestration β”‚ └── .devcontainer/ # VS Code Dev Container config β”‚ β”œβ”€β”€ .github/ β”‚ β”œβ”€β”€ workflows/ β”‚ β”‚ β”œβ”€β”€ backend.yml # Backend CI: lint, test, build β”‚ β”‚ β”œβ”€β”€ frontend.yml # Frontend CI: lint, test, build β”‚ β”‚ └── docker.yml # Docker Compose integration test β”‚ └── pull_request_template.md β”‚ β”œβ”€β”€ CONTRIBUTING.md # Branch strategy, code review, guidelines β”œβ”€β”€ .env.example # Unified environment template └── package.json # Root scripts (dev, build, test, lint) ``` ## πŸ§ͺ Testing ```bash # Run all tests (22 total) npm test # Backend only (11 tests: health, routes, validation, CORS, 404) npm run test:backend # Frontend only (11 tests: tier limits, chart components) npm run test:frontend ``` ## πŸ“Š CI/CD Pipelines | Workflow | Trigger | What it does | |----------|---------|-------------| | `backend.yml` | Push/PR to backend | Lint β†’ Test β†’ Build (Node 18 & 20) | | `frontend.yml` | Push/PR to frontend | Lint β†’ Test β†’ Build (Node 18 & 20) | | `docker.yml` | Push/PR to main | Docker Compose build β†’ Backend health check | ## πŸ”‘ Key API Routes | Route | Method | Description | |-------|--------|-------------| | `/api/cron/uptime` | GET | Runs uptime checks on all active websites | | `/api/cron/scan` | GET | Triggers Lighthouse scans for due websites | | `/api/notifications/process` | POST | Processes pending alerts and sends notifications | | `/api/admin/stats` | GET | System-wide stats (admin only) | | `/api/admin/users` | GET/PATCH/DELETE | User management (admin only) | | `/api/admin/organizations` | GET/PATCH | Organization management (admin only) | | `/api/billing/usage` | GET | Current org usage vs tier limits | | `/api/competitor-analysis` | GET/POST | Competitor benchmarking | ## πŸ— Tier System | Tier | Websites | Scans/mo | Members | Price | |------|----------|----------|---------|-------| | Free | 3 | 50 | 2 | $0 | | Starter | 10 | 500 | 5 | $9/mo | | Professional | 50 | 5,000 | 25 | $29/mo | | Enterprise | ∞ | ∞ | ∞ | $99/mo | ## 🀝 Contributing See [CONTRIBUTING.md](./CONTRIBUTING.md) for branch strategy, code style, and PR process. ## πŸ“„ License ISC