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>
This commit is contained in:
Dennis
2026-03-07 01:04:37 +01:00
parent 50e25e3ee8
commit 379d9aa13c
18 changed files with 2956 additions and 67 deletions
+13 -9
View File
@@ -1,10 +1,10 @@
# 🔍 Website Monitoring Platform
# ⬡ CloudLense
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.
Full-stack website monitoring & performance auditing platform powered by **Google Lighthouse** — with real-time progress tracking, team collaboration, billing, and alerting.
```
┌─────────────────────────────────────────────────────────┐
Website Monitoring
CloudLense
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │
│ │ Frontend │───▶│ Backend │───▶│ PostgreSQL (DB) │ │
@@ -32,9 +32,9 @@ Full-stack website monitoring platform that uses **Google Lighthouse** to audit
| **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 |
| **Notifications** | ✅ Real | SMTP email (info@dk0.dev) + webhook delivery with debouncing |
| **Admin Dashboard** | ✅ Real | System stats, user CRUD, org management, payments, coupons, credits, invoices |
| **Billing & Usage** | ✅ Real | 4 tiers (free/starter/pro/enterprise), usage bars, limit enforcement, coupon system |
| **Competitor Analysis** | ✅ Real | Lighthouse comparison + response time benchmarking |
| **Team/Organization** | ✅ Real | Multi-user orgs with 4-level RBAC |
| **Authentication** | ✅ Real | Supabase Auth (email, OAuth) |
@@ -55,7 +55,7 @@ Full-stack website monitoring platform that uses **Google Lighthouse** to audit
| Containers | Docker + Docker Compose | Free |
| Linting | ESLint + Prettier | Free (OSS) |
| Testing | Jest + Supertest + Testing Library | Free (OSS) |
| Email | Resend | Free tier (3000/mo) |
| Email | SMTP (nodemailer) | Self-hosted |
| Pre-commit | Husky | Free (OSS) |
## 🚀 Quick Start
@@ -71,7 +71,7 @@ Full-stack website monitoring platform that uses **Google Lighthouse** to audit
```bash
# Clone the repo
git clone <repo-url>
cd website-monitoring
cd cloudlense
# Install root dependencies (Husky, concurrently)
npm install
@@ -108,7 +108,7 @@ npm run docker:up
## 📁 Project Structure
```
website-monitoring/
cloudlense/
├── backend/ # Express.js API + Lighthouse engine
│ ├── src/
│ │ ├── index.ts # Server entry, health check, routing
@@ -173,6 +173,10 @@ npm run test:frontend
| `/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/admin/payments` | GET/POST | Payment tracking & recording (admin only) |
| `/api/admin/coupons` | GET/POST/PATCH/DELETE | Coupon management (admin only) |
| `/api/admin/credits` | GET/POST | Account credit management (admin only) |
| `/api/admin/invoices` | GET/POST/PATCH | Invoice creation, sending & management (admin only) |
| `/api/billing/usage` | GET | Current org usage vs tier limits |
| `/api/competitor-analysis` | GET/POST | Competitor benchmarking |