Files
cloudlense/website-monitoring-backend/README.md
T
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

57 lines
1.5 KiB
Markdown

# 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
```bash
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
```bash
docker build -t website-monitoring-backend .
docker run -p 5000:5000 website-monitoring-backend
```