# Website Monitor **A comprehensive website monitoring application built with ReasonML, OCaml, and server-reason-react** ## 🎯 What This Is A full-stack, production-ready web application that: - Monitors multiple websites for HTTP 200 status deviations - Sends alerts via email or webhooks when issues occur - Provides a beautiful admin dashboard - Offers a complete REST API for programmatic access - Runs entirely in Docker with CPU constraints ## 🚀 Quick Start ```bash # 1. Clone and setup git clone cd test3 cp .env.example .env # 2. Edit .env with your SMTP credentials # (Required for email alerts) # 3. Start docker-compose up -d # 4. Access # Open: http://localhost:8080 ``` ## 📚 Documentation - **[QUICKSTART.md](QUICKSTART.md)** - Get started in 5 minutes - **[README.md](README.md)** - Complete documentation - **[ARCHITECTURE.md](ARCHITECTURE.md)** - Technical details - **[BUILD_SUMMARY.md](BUILD_SUMMARY.md)** - What was built - **[CONTRIBUTING.md](CONTRIBUTING.md)** - How to contribute ## ✨ Features - **Website Monitoring**: Real-time status checking - **Alerts**: Email (SMTP) and Webhook notifications - **Dashboard**: Beautiful admin UI with Tailwind CSS - **REST API**: Full CRUD operations - **History**: Track all checks with detailed logs - **Scheduler**: Background monitoring with configurable intervals - **Docker**: Multi-container setup with CPU constraints (1 core) ## 🛠️ Tech Stack - **Backend**: OCaml 5.0+ with ReasonML - **Framework**: Dream (OCaml web framework) - **Frontend**: server-reason-react (server-side React) - **Database**: PostgreSQL 16 with Caqti - **Async**: Lwt (cooperative threading) - **Container**: Docker & Docker Compose ## 📊 API Examples ```bash # List websites curl http://localhost:8080/api/websites # Add website curl -X POST http://localhost:8080/api/websites \ -H "Content-Type: application/json" \ -d '{ "name": "Example", "url": "https://example.com" }' # Get stats curl http://localhost:8080/api/stats/summary ``` ## 🔧 Key Commands ```bash # Start application docker-compose up -d # View logs docker-compose logs -f # Stop application docker-compose down # Build locally make build # Run tests make test ``` ## 📁 Project Structure ``` test3/ ├── bin/ # Application entry points ├── lib/ # Core library modules │ ├── database.ml # Database models │ ├── monitor.ml # Monitoring logic │ ├── alert.ml # Alert system │ ├── api.ml # REST API │ ├── ui.ml # Admin UI │ └── scheduler.ml # Background jobs ├── test/ # Tests ├── docker/ # Docker configs ├── scripts/ # Utility scripts └── docs/ # Documentation ``` ## 🎨 Pages - **Dashboard** (`/`) - Overview and statistics - **Websites** (`/dashboard/websites`) - Manage monitored sites - **Alerts** (`/dashboard/alerts`) - Configure notifications - **Settings** (`/dashboard/settings`) - Application config ## 🔒 Security - SQL injection prevention (parameterized queries) - Environment-based configuration - No hardcoded secrets - Limited database privileges - CORS configuration ## 📈 Performance - Connection pooling (5 connections) - Async operations (Lwt) - Configurable check intervals - Automatic history cleanup - Single-threaded OCaml runtime ## 🐳 Docker - Multi-stage builds - CPU constraints (1 core) - Health checks - Automated database initialization - Production-ready ## 🤝 Contributing We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) ## 📝 License MIT License - See [LICENSE](LICENSE) ## 🆘 Support - Issues: GitHub Issues - Documentation: See docs in repository - Questions: GitHub Discussions --- **Built with ❤️ using ReasonML, OCaml, and server-reason-react**