Files
aitest-reasonml-mon-fbk/PROJECT.md
Charles N Wyble e1ff581603 feat: initial commit - complete website monitoring application
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
2026-01-13 15:56:42 -05:00

3.8 KiB

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

# 1. Clone and setup
git clone <repository-url>
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

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

# 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

# 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

📝 License

MIT License - See LICENSE

🆘 Support

  • Issues: GitHub Issues
  • Documentation: See docs in repository
  • Questions: GitHub Discussions

Built with ❤️ using ReasonML, OCaml, and server-reason-react