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
3.8 KiB
3.8 KiB
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
-
Prerequisites:
- OCaml 5.0+
- OPAM package manager
- Docker (optional, but recommended)
- PostgreSQL 14+ (for local development)
-
Clone and Setup:
git clone <repository-url> cd test3 opam switch create . 5.2.0 eval $(opam env) opam install . --deps-only --with-test -
Build and Test:
make build make test -
Run Locally:
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
- Modules:
Comments
- Document public functions with comments
- Use
(* ... *)for multi-line comments - Explain non-obvious logic
Error Handling
- Use
Lwt.catchfor async error handling - Log errors appropriately using
Logsmodule - Provide meaningful error messages
Testing
Unit Tests
- Write unit tests for all public functions
- Use
OUnitframework - Place tests in the
test/directory
Integration Tests
- Test API endpoints
- Test database operations
- Test alert functionality
Running Tests
# Run all tests
make test
# Run specific test
dune runtest --focus test_name
Pull Request Process
-
Fork and Branch:
git fork git checkout -b feature/your-feature-name -
Make Changes:
- Write clean, well-documented code
- Add/update tests
- Update documentation if needed
-
Commit:
git add . git commit -m "feat: add your feature description" -
Push and PR:
git push origin feature/your-feature-nameThen create a pull request on GitHub.
Commit Message Format
Follow conventional commits:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting)refactor:- Code refactoringtest:- Test changeschore:- 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!