A simple, production-ready web application that monitors websites and sends email notifications when they go offline.
- Simple Web Interface: Clean, responsive UI for adding and managing monitored websites
- Automatic Status Checking: Background job runs every 60 minutes to check website status
- Email Notifications: Sends email alerts when a website goes from "Online" to "Offline"
- Smart State Management: Prevents duplicate emails for sites that remain offline
- File-Based Database: Uses a simple JSON file for data persistence
- Real-time Updates: Auto-refreshes status on the UI every 30 seconds
- Node.js (v14 or higher)
- npm (Node Package Manager)
- SMTP email account for sending notifications (e.g., Gmail, SendGrid, etc.)
- Docker & Docker compose (Recommended)
Clone the repository and navigate to the project directory:
git clone stable https://github.com/StratosL/Site-Check.git
cd Site-Check
npm install
Before running the services, you need to set up your environment variables.
Create a .env
file in the root directory (copy from .env.example
):
cp .env.example .env
Edit the .env
file with your email configuration:
# SMTP Configuration for Email Notifications
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
# Email address to receive notifications
NOTIFICATION_EMAIL=admin@example.com
# Check interval in minutes (default: 60)
CHECK_INTERVAL=60
# Server port (default: 3000)
PORT=3000
- Enable 2-factor authentication on your Gmail account
- Generate an app password: https://myaccount.google.com/apppasswords
- Use your Gmail address as
SMTP_USER
and the app password asSMTP_PASS
Correct Formatting
Let's say your App Password is:
abcd efgh ijkl mnop
In your .env file, it should look like this, with no spaces:
EMAIL_PASS="abcdefghijklmnop"
In the directory Site-Check run:
docker compose up -d
For production:
npm start
For development (with auto-restart):
npm run dev
The application will be available at http://localhost:3000
site-check/
├── server.js # Main server file with all backend logic
├── package.json # Node.js dependencies and scripts
├── .env # Environment configuration (create from .env.example)
├── .env.example # Example environment configuration
├── db.json # Database file (auto-created)
├── README.md # This file
└── public/ # Frontend files
├── index.html # Main HTML file
├── style.css # Styles
└── script.js # Frontend JavaScript
-
Access the Application: Open
http://localhost:3000
in your web browser -
Add a Website:
- Enter a URL in the input field (e.g.,
https://example.com
) - Click "Add Website" or press Enter
- The website will be added with status "Checking..."
- Enter a URL in the input field (e.g.,
-
Monitor Status:
- Websites are checked every 60 minutes
- Status updates automatically on the UI every 30 seconds
- Possible statuses: "Online", "Offline", or "Checking..."
-
Remove a Website:
- Click the "Remove" button next to any website
- Confirm the removal when prompted
- Each website is checked with an HTTP HEAD request (falls back to GET if needed)
- 10-second timeout for each request
- Status codes 2xx and 3xx are considered "Online"
- Any other response or timeout is considered "Offline"
- Emails are sent ONLY when a site changes from "Online" to "Offline"
- No duplicate emails for sites that remain offline
- Email includes the website URL and timestamp
- All data is stored in
db.json
file - Automatically created on first run
- Human-readable JSON format
- Check your SMTP credentials in
.env
- Ensure your firewall allows outgoing connections on the SMTP port
- For Gmail, make sure you're using an app password, not your regular password
- Check the console logs for specific error messages
- Ensure the URL includes the protocol (http:// or https://)
- Check if the website is accessible from your server
- Some websites block automated requests - try a different site
Change the port in .env
file:
PORT=3001
- Never commit
.env
file to version control - Use strong passwords for email accounts
- Consider rate limiting for the API endpoints in production
- Implement authentication if deploying publicly
For production deployment, consider:
-
Using a process manager like PM2:
npm install -g pm2 pm2 start server.js --name site-check
-
Setting up a reverse proxy with Nginx
-
Using a more robust database solution for high-scale deployments
-
Implementing user authentication and multi-tenancy
-
Adding HTTPS with SSL certificates
This project is provided as-is for educational and commercial use.