Build a comprehensive website monitoring application with ReasonML, OCaml, and server-reason-react.
Features:
- Real-time website monitoring with HTTP status checks
- Email and webhook alerting system
- Beautiful admin dashboard with Tailwind CSS
- Complete REST API for CRUD operations
- Background monitoring scheduler
- Multi-container Docker setup with 1-core CPU constraint
- PostgreSQL database with Caqti
- Full documentation and setup guides
Tech Stack:
- OCaml 5.0+ with ReasonML
- Dream web framework
- server-reason-react for UI
- PostgreSQL 16 database
- Docker & Docker Compose
Files:
- 9 OCaml source files (1961 LOC)
- 6 documentation files (1603 LOC)
- Complete Docker configuration
- Comprehensive API documentation
💘 Generated with Crush
177 lines
3.8 KiB
Markdown
177 lines
3.8 KiB
Markdown
# Contributing to Website Monitor
|
|
|
|
Thank you for your interest in contributing to Website Monitor! This document provides guidelines and instructions for contributing to the project.
|
|
|
|
## Development Setup
|
|
|
|
1. **Prerequisites**:
|
|
- OCaml 5.0+
|
|
- OPAM package manager
|
|
- Docker (optional, but recommended)
|
|
- PostgreSQL 14+ (for local development)
|
|
|
|
2. **Clone and Setup**:
|
|
```bash
|
|
git clone <repository-url>
|
|
cd test3
|
|
opam switch create . 5.2.0
|
|
eval $(opam env)
|
|
opam install . --deps-only --with-test
|
|
```
|
|
|
|
3. **Build and Test**:
|
|
```bash
|
|
make build
|
|
make test
|
|
```
|
|
|
|
4. **Run Locally**:
|
|
```bash
|
|
docker-compose -f docker/docker-compose.dev.yml up -d
|
|
DATABASE_URL="postgresql://monitor_user:dev_password@localhost:5433/website_monitor_dev" dune exec bin/main.exe
|
|
```
|
|
|
|
## Code Style
|
|
|
|
### OCaml/ReasonML
|
|
|
|
- Use 4 spaces for indentation (no tabs)
|
|
- Follow OCaml naming conventions:
|
|
- Modules: `PascalCase`
|
|
- Types: `PascalCase`
|
|
- Values: `snake_case`
|
|
- Constants: `ALL_CAPS`
|
|
|
|
### Comments
|
|
|
|
- Document public functions with comments
|
|
- Use `(* ... *)` for multi-line comments
|
|
- Explain non-obvious logic
|
|
|
|
### Error Handling
|
|
|
|
- Use `Lwt.catch` for async error handling
|
|
- Log errors appropriately using `Logs` module
|
|
- Provide meaningful error messages
|
|
|
|
## Testing
|
|
|
|
### Unit Tests
|
|
|
|
- Write unit tests for all public functions
|
|
- Use `OUnit` framework
|
|
- Place tests in the `test/` directory
|
|
|
|
### Integration Tests
|
|
|
|
- Test API endpoints
|
|
- Test database operations
|
|
- Test alert functionality
|
|
|
|
### Running Tests
|
|
|
|
```bash
|
|
# Run all tests
|
|
make test
|
|
|
|
# Run specific test
|
|
dune runtest --focus test_name
|
|
```
|
|
|
|
## Pull Request Process
|
|
|
|
1. **Fork and Branch**:
|
|
```bash
|
|
git fork
|
|
git checkout -b feature/your-feature-name
|
|
```
|
|
|
|
2. **Make Changes**:
|
|
- Write clean, well-documented code
|
|
- Add/update tests
|
|
- Update documentation if needed
|
|
|
|
3. **Commit**:
|
|
```bash
|
|
git add .
|
|
git commit -m "feat: add your feature description"
|
|
```
|
|
|
|
4. **Push and PR**:
|
|
```bash
|
|
git push origin feature/your-feature-name
|
|
```
|
|
|
|
Then create a pull request on GitHub.
|
|
|
|
### Commit Message Format
|
|
|
|
Follow conventional commits:
|
|
|
|
- `feat:` - New feature
|
|
- `fix:` - Bug fix
|
|
- `docs:` - Documentation changes
|
|
- `style:` - Code style changes (formatting)
|
|
- `refactor:` - Code refactoring
|
|
- `test:` - Test changes
|
|
- `chore:` - Build process or auxiliary tool changes
|
|
|
|
Example:
|
|
```
|
|
feat: add webhook alert type
|
|
|
|
Add support for webhook alerts with configurable
|
|
URL, method, headers, and body template.
|
|
|
|
Closes #123
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
test3/
|
|
├── bin/ # Application binaries
|
|
│ ├── main.ml # Main entry point
|
|
│ └── init_db.ml # Database initialization
|
|
├── lib/ # Library code
|
|
│ ├── database.ml # Database models and queries
|
|
│ ├── monitor.ml # Website monitoring logic
|
|
│ ├── alert.ml # Alerting system
|
|
│ ├── api.ml # REST API handlers
|
|
│ ├── ui.ml # Server-side React UI
|
|
│ └── scheduler.ml # Background scheduler
|
|
├── test/ # Tests
|
|
│ └── test.ml # Unit tests
|
|
├── docker/ # Docker configurations
|
|
└── docs/ # Additional documentation
|
|
```
|
|
|
|
## Feature Ideas
|
|
|
|
We welcome contributions for:
|
|
|
|
- **SMS alerts** (Twilio, etc.)
|
|
- **Slack integration**
|
|
- **Push notifications**
|
|
- **Performance metrics tracking**
|
|
- **Multi-user support**
|
|
- **Dashboard widgets**
|
|
- **Export reports**
|
|
- **API authentication**
|
|
- **Rate limiting**
|
|
- **Custom check scripts**
|
|
|
|
## Getting Help
|
|
|
|
- Open an issue for bugs or questions
|
|
- Join our discussions for feature ideas
|
|
- Check existing PRs and issues before starting
|
|
|
|
## License
|
|
|
|
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
|
|
## Thank You!
|
|
|
|
We appreciate your contributions to making Website Monitor better!
|