This API enables users to manage and monitor website or service availability through the following features:
- CRUD Users: Create, read, update, and delete user information.
- CRUD Tokens: Manage authentication tokens for secure API access.
- CRUD Checks: Configure monitoring checks for specific URLs with custom settings.
Checks are JSON files containing monitoring details such as URL, protocol, HTTP method, success status codes, timeout, and status. The system reads these checks every minute, makes network requests to the specified URLs, and evaluates responses against the defined success codes. It updates the status (up
or down
) in the check file and sends SMS notifications via Twilio when the status changes (e.g., from up
to down
or vice versa).
This ensures real-time monitoring and alerting for critical services.
Please follow the below instructions to run this project in your machine:
- Install dependencies
pnpm install
- Run the app
pnpm run development
- Your app should be available in http://localhost:3000
POST http://localhost:3000/users
{"firstName": "Mr", "lastName": "Karim", "phone": "01711091062", "password": "12345", "tosAgreement": false }
Status: 400 Bad Request
{
"message": "Something went wrong. The user may already exist"
}
Or
Status: 201 Created
{
"message": "User created"
}
GET http://localhost:3000/users?phone=01711091061
{
"token": "your-authentication-token"
}
Status: 400 Bad Request
{
"message": "Something went wrong. Could not find user"
}
Or
Status: 200 OK
{
"user": {
"firstName": "Mr",
"lastName": "Karim",
"phone": "01711091062",
"password": "7571408e70935dbc6a828cb6369572e1",
"tosAgreement": false
}
}
PUT http://localhost:3000/users
{
"token": "your-authentication-token"
}
{"firstName": "Muaz", "lastName": "Abdullah", "phone": "01711091062", "password": "abcdefg", "tosAgreement": true }
Status: 400 Bad Request
{
"message": "Something went wrong. Could not update the user"
}
Or
Status: 200 OK
{
"message": "User updated"
}
DELETE http://localhost:3000/users?phone=01711091061
{
"token": "your-authentication-token"
}
Status: 400 Bad Request
{
"message": "Something went wrong. Could not delete user"
}
Or
Status: 200 OK
{
"message": "User deleted"
}
POST http://localhost:3000/token
{"phone": "01779898372", "password": "12345"}
Status: 201 Created
{
"message": "Token created"
}
Or
{"phone": "0177989837200", "password": "12345"}
Status: 400 Bad Request
{
"message": "Something went wrong. Please check if the user exists or the token may already exists"
}
GET http://localhost:3000/token?id=1ba281e35ce83cb
Status: 400 Bad Request
{
"message": "Bad request. Please provide a valid token."
}
Or
GET http://localhost:3000/token?id=1ba281e35ce83cb00003
Status: 200 OK
{
"token": {
"id": "1ba281e35ce83cb00003",
"phone": "01779898372",
"expirationTime": 1736657694552
}
}
PUT http://localhost:3000/token
{"id": "1ba281e35ce83cb", "extend": true}
Status: 400 Bad Request
{
"message": "Bad request. Please provide a valid token id and extend."
}
Or
{"id": "1ba281e35ce83cb00003", "extend": true}
Status: 200 OK
{
"message": "Token updated."
}
DELETE http://localhost:3000/token?id=1ba281e35ce83cb
Status: 400 Bad Request
{
"message": "Bad request. Please check the token ID."
}
Or
GET http://localhost:3000/token?id=1ba281e35ce83cb00003
Status: 200 OK
{
"message": "Token deleted."
}
POST http://localhost:3000/check
{ token: your-token }
{
"protocol": "http",
"url": "facebook.com",
"method": "get",
"successCodes": [200],
"timeoutSeconds": 4
}
Status: 201 Created
{
"message": "Check ceated."
}
GET http://localhost:3000/check?id=a6d8ecb143
{ token: your-token }
Status: 200 OK
{
"check": {
"id": "a6d8ecb143",
"protocol": "http",
"url": "facebook.com",
"method": "get",
"successCodes": [
200
],
"timeoutSeconds": 4
}
}
PUT http://localhost:3000/check
{
"id": "a6d8ecb143",
"protocol": "https",
"url": "booble.com",
"method": "put",
"successCodes": [301, 201],
"timeoutSeconds": 5
}
At this moment, the maximum value of timeoutSeconds can be 5.
Status: 200 OK
{
"message": "Check updated."
}
DELETE http://localhost:3000/check?id=a6d8ecb143
Status: 200 OK
{
"message": "Check deleted."
}