A simple and scalable website monitoring service built with Go. It periodically checks if your websites are up and sends email alerts when they go down or recover.
- 🔍 Website Monitoring - Checks HTTPS websites every 10 minutes
- 📧 Email Alerts - Sends notifications when sites go down or recover
- 🔐 Email Verification - Users must verify their email before monitoring starts
- ⚡ Smart Alerts - Only sends emails when status changes (no spam!)
- 🚀 Concurrent Checks - Configurable worker pool for parallel checking
- 💾 Status Tracking - Redis-based status memory to prevent duplicate alerts
- Go - Backend API and monitoring service
- Gin - HTTP web framework
- MongoDB - User and website storage
- Redis - Status tracking and token storage
- SMTP - Email delivery
- Go 1.21+
- MongoDB
- Redis
- SMTP server (e.g., smtp2go, SendGrid)
git https://github.com/CodemHax/downtimetracker
cd downtimetracker
go mod downloadCreate a .env file:
MONGODB_URI=mongodb://localhost:27017
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
SMTP_HOST=mail.smtp2go.com
SMTP_PORT=2525
SMTP_USER=your-username
SMTP_PASS=your-password
SMTP_FROM=noreply@yourdomain.com
LINK=http://localhost:8080
CHECKER_TIMEOUT=5000
CHECKER_CONCURRENCY=5go run .Server starts at http://localhost:8080
GET /ping
Response: {"message": "pong"}
POST /add
Content-Type: application/json
{
"email": "user@example.com",
"website": "https://yoursite.com"
}
GET /verify?email=user@example.com&token=YOUR_TOKEN
After starting the server, access the Swagger UI at:
http://localhost:8000/swagger/index.html
To update the docs after changing endpoints or comments, run:
swag init
downtimetracker/
├── main.go # Entry point
├── cmd/
│ └── api.go # API handlers
├── internals/
│ ├── database/
│ │ ├── mongo/ # MongoDB client
│ │ └── redis/ # Redis client
│ ├── mail/ # SMTP email sender
│ ├── models/ # Data models
│ └── utlis/ # Checker utilities
├── .env # Configuration
├── .gitignore
└── README.md
- User adds a website via
/addendpoint - Verification email is sent to the user
- User clicks the verification link
- Service starts monitoring the website every 10 minutes
- If site goes down → Email alert sent
- If site recovers → Recovery email sent
- No repeated emails while status unchanged
MIT