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

88 lines
2.3 KiB
Markdown

# 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
```bash
# Clone & install
git clone <repo-url>
cd website-monitoring
npm install
# Install project dependencies
cd website-monitoring-backend && npm install && cd ..
cd website-monitoring-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**:
```bash
npm run lint # No errors
npm run test # All pass
npm run build # Compiles clean
```
4. **Commit**: Use [Conventional Commits](https://www.conventionalcommits.org/)
```
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 website-monitoring-backend && npm test`
- **Frontend**: Jest + Testing Library — `cd website-monitoring-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
```bash
# Full stack with Docker Compose
npm run docker:up
# Tear down
npm run docker:down
```