Monitor your websites, servers and APIs 24/7 with instant alerts and customizable status pages.
flowchart TD
START([User adds website<br/>to monitor]) --> ADD_DB[(Website saved<br/>in database)]
ADD_DB --> TIMER{Every 3 minutes<br/>timer triggers}
TIMER --> PUSHER[Pusher Service<br/>Gets all websites from DB<br/>and puts jobs in queue]
PUSHER --> REDIS_QUEUE[(Redis Queue<br/>Jobs waiting<br/>Check google.com<br/>Check facebook.com<br/>Check your-site.com)]
REDIS_QUEUE --> WORKER[Worker Service<br/>Takes jobs from queue<br/>one by one]
WORKER --> CHECK_WEBSITE{Worker visits<br/>the website}
CHECK_WEBSITE -->|Website loads| WEBSITE_UP[Website is UP<br/>Response time 250ms]
CHECK_WEBSITE -->|Timeout or Error| WEBSITE_DOWN[Website is DOWN<br/>Error Connection failed]
WEBSITE_UP --> SAVE_UP[Save result to DB<br/>Status UP Time 250ms]
WEBSITE_DOWN --> SAVE_DOWN[Save result to DB<br/>Status DOWN Error msg]
SAVE_UP --> CHECK_CHANGE_UP{Did status change<br/>from DOWN to UP?}
SAVE_DOWN --> CHECK_CHANGE_DOWN{Did status change<br/>from UP to DOWN?}
CHECK_CHANGE_UP -->|Yes| SEND_RECOVERY[Send recovery email<br/>Website is back online]
CHECK_CHANGE_UP -->|No| NO_EMAIL_UP[No email needed<br/>Still working fine]
CHECK_CHANGE_DOWN -->|Yes| SEND_ALERT[Send alert email<br/>Website is down]
CHECK_CHANGE_DOWN -->|No| NO_EMAIL_DOWN[No email needed<br/>Still down]
SEND_RECOVERY --> GMAIL[Gmail SMTP<br/>sends email to user]
SEND_ALERT --> GMAIL
GMAIL --> YOUR_EMAIL[User receives email<br/>on phone or computer]
NO_EMAIL_UP --> NEXT_JOB
NO_EMAIL_DOWN --> NEXT_JOB
YOUR_EMAIL --> NEXT_JOB{More websites<br/>in queue?}
NEXT_JOB -->|Yes| WORKER
NEXT_JOB -->|No| WAIT[Wait for next<br/>3-minute cycle]
WAIT --> TIMER
| Concept | Redis Command | Code Usage | Example Usage & Purpose |
|---|---|---|---|
| Stream | XADD | xAddBulk | Add a website to check: XADD betteruptime:websites * url "https://example.com" id "123" (Queues a website for workers to check) |
| Consumer Group | XGROUP CREATE | setup.ts | Create a group for workers: XGROUP CREATE betteruptime:websites europe $ MKSTREAM (Lets multiple workers process tasks reliably) |
| Read Tasks | XREADGROUP | xReadGroup | Worker reads tasks: XREADGROUP GROUP europe worker1 COUNT 10 STREAMS betteruptime:websites > (Worker fetches websites to check) |
| Ack Tasks | XACK | xAckBulk | Worker marks task done: XACK betteruptime:websites europe 1526569495631-0 (Confirms website was checked) |
- Website checks are scheduled every 3 minutes by the producer service.
- The system records response time for each check by measuring the duration of the HTTP request.
- Failures and errors are handled by logging the issue and sending notifications to users if enabled.
- The architecture supports easy scaling: add more workers or regions as needed.
What does the worker service do?
Continuously checks websites, records results, and sends notifications if a site goes down or recovers.
What does the pusher (producer) service do?
Periodically adds website check tasks to the Redis stream for workers to process.
How do you ping a website?
By making an HTTP GET request using Axios. If it succeeds, the site is "Up"; if it fails, "Down".
How do you handle notifications?
When a site goes down, the worker checks user notification settings and sends alerts (e.g., email) if enabled.
Does the system support multi-region monitoring?
Yes. Deploy workers in different regions and set their REGION_ID. Each worker records results for its region.
Main Features:
- Website uptime checks
- Multi-region support
- Instant notifications
- Status tracking and logging
- Extensible architecture (add more regions easily)
