379d9aa13c
- 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>
Website Monitoring Backend
Express.js API server that runs Google Lighthouse audits on websites and streams real-time progress via Server-Sent Events.
Tech Stack
- Runtime: Node.js 18+
- Framework: Express.js
- Language: TypeScript
- Auditing: Google Lighthouse + Chrome Headless
- Database: PostgreSQL (via
pg)
Quick Start
cp .env.example .env
npm install
npm run build
npm start
Scripts
| Script | Description |
|---|---|
npm run build |
Compile TypeScript to dist/ |
npm start |
Run the production server |
npm run dev |
Watch mode for development |
npm test |
Run Jest tests |
npm run test:coverage |
Run tests with coverage report |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
API Endpoints
| Method | Path | Description |
|---|---|---|
GET |
/ |
API info |
GET |
/health |
Health check |
POST |
/api/lighthouse |
Start Lighthouse audit (body: { "url": "https://example.com" }) |
GET |
/api/lighthouse/status/:id |
SSE stream for audit progress |
Environment Variables
| Variable | Default | Description |
|---|---|---|
PORT |
5000 |
Server port |
DATABASE_URL |
— | PostgreSQL connection string |
CORS_ORIGIN |
* |
Allowed CORS origin |
CHROME_PATH |
— | Path to Chrome binary (Docker) |
Docker
docker build -t website-monitoring-backend .
docker run -p 5000:5000 website-monitoring-backend