This is a backend only repository, frontend implementations can vary. An example implementation is here the repository of which can be viewed here
OutWatch is a backend service designed for monitoring your application’s uptime and assisting with bug report management. It periodically checks service status, logs uptime data, and sends notifications to a Discord channel when a service is offline. User-submitted bug reports are also forwarded to Discord.
- Automated Uptime Tracking: Regularly monitors service status every 10 minutes, logging results for analysis. Accessible through discord and GET requests.
- Discord Notifications: Alerts Discord channels for any downtime or submitted bug reports.
- Discord Command: Allows you to check the current service status through a discord command /service-status.
- User Bug Reporting: Users can submit detailed bug reports, saved in the database and forwarded to a designated Discord channel.
- Data Retention Policy: Logs older than 7 days are automatically deleted, ensuring relevant, up-to-date data.
- Private & Public Services: Allows you to have some services to be publicly displayable on any service tracking webpage through GET requests, while allowing you to have some services that are private and only visible through the discord client.
- Node.js (version 14.x or higher)
- npm
- PostgreSQL as the primary database
- Clone the repository:
git clone https://github.com/yourusername/outwatch-backend.git cd outwatch-backend
- Install dependencies:
npm install
-
Environment Variables:
Create a.env
file in the root directory by cloning the.env.sample
and fill it with appropriate data. -
Service Visibility
Ensure./src/seeders/serviceSeeder.js
is correctly configured to mark services as private or public, controlling their accessibility via Discord or publicly.- This public repository includes some services marked as private. However, since the repo is public, these services (in my case) aren't truly private.
- To maintain privacy, ensure your configuration files aren't publicly accessible. The code alone won't, however, shouldn't expose your services.*
-
Personal Remark: I marked certain services as private to prevent unnecessary spam on my website while managing them within the same open-source repo for easy updates and deployment – these URL's being publicly visible isn't any issue beyond spam for me.
To start the server and scheduler, use:
npm start
The server should now be running on http://localhost:3000
, with uptime checks scheduled to execute every 10 minutes.
Once up and running, OutWatch will:
- Perform periodic health checks on all configured services every 10 minutes, logging status updates and notifying a designated Discord channel if any service is offline.
- Accept and store user-submitted bug reports, forwarding them to a specific Discord channel for real-time updates.
- GET /api/status
Retrieves the current status of all monitored services.
- POST /api/bug
Allows users to submit a bug report. RequiresserviceId
anddescription
;email
is optional.- Parameters:
serviceId
: The ID of the affected service.description
: Details of the issue encountered.email
(optional): User's email for follow-up.
- Parameters:
There are multiple ways to add services to OutWatch:
- Database Insertion: Manually insert entries in the
Service
table. - Database Seeder: Use the
seeders/serviceSeeder.js
to initialize predefined services.
-
POST
/api/contact
-
Description: Sends a contact message to a designated Discord channel.
-
Optional: Don't set up the contactChannel in the ENV and this will not be enabled. Typically most users won't need this, I just added it for personal use and fun. (
FAFO :)
)
Request Body:
{
"name": "John Doe", // optional
"message": "This is a sample message", // required, string, <2000 characters
"contact": "[email protected]" OR "discord: @vijitdua" OR "any string" // optional
}
- Node.js and Express – Server and API routing.
- PostgreSQL – Primary data storage and persistence.
- Discord.js – For Discord notification integration on outages and bug reports.
- Sequelize – ORM for PostgreSQL.
- node-cron – Schedules regular uptime checks.
This project is licensed under the MIT License. See LICENSE for more information.
OutWatch is designed to maintain up-to-date information, automatically deleting logs older than 7 days to keep data relevant.
- Parts of README.md written by ChatGPT based on code and user prompt.
- *subject to the code license