Commit Graph

11 Commits

Author SHA1 Message Date
Dennis 2236725965 fix: enable Next.js standalone output for Docker builds
- Add output: 'standalone' to next.config.ts
- Fixes Docker build: .next/standalone now generated correctly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-07 01:28:38 +01:00
Dennis 77bac590b3 fix: add SUPABASE_SERVICE_ROLE_KEY to CI build env
- Add placeholder service role key to frontend CI workflow build step
- Add build ARGs to Dockerfile for Supabase env vars
- Fixes: Next.js page data collection crash during build

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-07 01:24:56 +01:00
Dennis 4d7f00be1f fix: add billing types and fix Supabase type casting for admin routes
- Add src/types/billing.ts with Payment, Coupon, CreditTransaction, Invoice types
- Cast all Supabase query results through 'unknown' for untyped billing tables
- All routes now build cleanly with strict TypeScript checking

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-07 01:21:05 +01:00
Dennis 5ebea6b0d6 fix: resolve CI failures — Node 20+, exclude scanner-worker from build
- Update GitHub Actions workflows to Node 20/22 (ESLint 10 requires Node 20+)
- Exclude scanner-worker/ from frontend tsconfig and .dockerignore
- Update engines to require Node >= 20

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-07 01:15:13 +01:00
Dennis 379d9aa13c feat: add admin billing system, SMTP email, rename to CloudLense
- Add payments, coupons, credits, invoices management to admin dashboard
- Add 7 new admin tabs: Overview, Users, Orgs, Payments, Coupons, Credits, Invoices
- Replace Resend with SMTP email via nodemailer (info@dk0.dev / mail.dk0.dev)
- Add professional branded email templates (alerts, welcome, invoice, credit, password reset)
- Add database migration for payments, coupons, coupon_redemptions, credit_transactions, invoices tables
- Add credit_balance column to organizations
- Add RLS policies for all new tables
- Add 4 new API routes: /api/admin/{payments,coupons,credits,invoices}
- Rename project from website-monitoring to CloudLense
- Update all package.json names and README

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-07 01:04:37 +01:00
Dennis 50e25e3ee8 refactor: flatten monorepo structure to backend/ frontend/ devops/
Rename subdirectories for a cleaner single-repo layout:
- website-monitoring-backend/  → backend/
- website-monitoring-frontend/ → frontend/
- website-monitoring-devops/   → devops/

Update all references in package.json scripts, CI workflows,
docker-compose, pre-commit hooks, and documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-07 00:25:29 +01:00
Dennis 4607af8def feat: local dev setup with SSR fix and one-command dev script
- Add Next.js instrumentation.ts to polyfill Node.js v25+ broken localStorage
- Add dev-setup.sh for one-command local development setup
- Disable Supabase analytics in config.toml (avoids slow logflare image pull)
- Switch backend dev script to tsx watch for better DX

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 22:31:11 +01:00
Dennis 1c545c93b4 feat: production hardening + smart subpage scanning with layout dedup
Security:
- Add CRON_SECRET auth to /api/cron/* endpoints
- Add admin role verification to /api/admin/* routes
- Add org membership check to /api/billing/usage
- Add security headers (HSTS, X-Frame-Options, CSP, etc.)
- Add env variable validation at startup
- Add rate limiting to backend API (30 req/min per IP)

Infrastructure:
- Multi-stage Dockerfiles with non-root user + healthchecks
- Updated cron workflow to pass CRON_SECRET header
- Updated .env.example with all optional vars

Smart subpage scanning:
- Crawler now computes template_hash (DOM structure without content)
- Scanner scans ALL unique-layout pages, not just main page
- Pages with same layout (e.g. product pages) scanned only once
- Deduplication by template_hash, fallback to content_hash
- Main page always scanned with high priority
- Re-checks subscription limits before each page scan

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 07:44:32 +01:00
Dennis d8de0a973a docs: update README with all implemented features, API routes, and tier system
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 00:52:48 +01:00
Dennis 0d2aef07bc feat: implement real uptime monitoring, alerts, admin dashboard, billing & usage tracking
- Uptime service: real HTTP HEAD checks with response time tracking
- Alert engine: evaluates scan results, auto-resolves recovered alerts
- Notifications: Resend email + webhook delivery
- Admin dashboard: system stats, user CRUD, org management (role-protected)
- Billing: tier limits (free/starter/pro/enterprise), usage tracking API
- Competitor analysis: real Lighthouse comparison + response time
- Tests: 11 backend + 11 frontend = 22 total tests passing
- Database: added competitor_metrics, alert_configurations tables

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 00:51:54 +01:00
Dennis 14a32bdc0d feat: initialize monorepo with full dev team best practices
- Unified monorepo with backend (Express), frontend (Next.js), and devops
- Backend: ESLint, Prettier, Jest tests (3 passing), health endpoint, .env.example
- Frontend: Fixed build errors, fixed all lint errors (0 remaining), tests passing
- DevOps: Docker Compose with PostgreSQL, backend, frontend + healthchecks
- CI/CD: 3 GitHub Actions workflows (backend, frontend, docker integration)
- DX: Husky pre-commit hooks with smart change detection
- Docs: Root README with architecture, CONTRIBUTING.md, PR template

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 00:05:50 +01:00