Files
cloudlense/CONTRIBUTING.md
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

2.2 KiB

Contributing to Website Monitoring

Branch Strategy

main          ← production-ready, protected
  └─ develop  ← integration branch
       └─ feature/xxx  ← your work
       └─ fix/xxx      ← bug fixes
       └─ chore/xxx    ← maintenance

Rules

  • Never push directly to main — always open a PR
  • Branch from develop for features, from main for hotfixes
  • Delete branches after merge

Development Setup

# Clone & install
git clone <repo-url>
cd website-monitoring
npm install

# Install project dependencies
cd backend && npm install && cd ..
cd frontend && npm install && cd ..

# Start everything
npm run dev

Workflow

  1. Create a branch: git checkout -b feature/my-feature develop
  2. Make changes: Write code, add tests
  3. Verify locally:
    npm run lint        # No errors
    npm run test        # All pass
    npm run build       # Compiles clean
    
  4. Commit: Use Conventional Commits
    feat: add uptime monitoring endpoint
    fix: resolve SSE connection leak
    chore: update lighthouse dependency
    docs: add API endpoint documentation
    test: add lighthouse service unit tests
    
  5. Push & open PR: Target develop (or main for hotfixes)

Code Review Checklist

  • Code compiles and all tests pass
  • New code has tests
  • No console.log left in production code (use proper logger)
  • TypeScript types are explicit (minimize any)
  • API changes are documented
  • Environment variables documented in .env.example
  • No secrets committed

Code Style

  • TypeScript everywhere (no plain JS)
  • ESLint for linting — npm run lint
  • Prettier for formatting — auto-runs on commit via Husky
  • Use async/await over .then() chains
  • Prefer named exports over default exports

Testing

  • Backend: Jest + Supertest — cd backend && npm test
  • Frontend: Jest + Testing Library — cd frontend && npm test
  • Aim for tests on all API endpoints and critical business logic
  • Use meaningful test names: it("should return 400 when URL is missing")

Docker

# Full stack with Docker Compose
npm run docker:up

# Tear down
npm run docker:down