{"id":17658767,"url":"https://github.com/deepakpathania-zz/noah","last_synced_at":"2025-05-07T13:20:27.901Z","repository":{"id":37879569,"uuid":"212853994","full_name":"deepakpathania-zz/Noah","owner":"deepakpathania-zz","description":"Scheduling as a service platform to make outbound requests recurringly.","archived":false,"fork":false,"pushed_at":"2022-12-30T18:49:31.000Z","size":782,"stargazers_count":8,"open_issues_count":18,"forks_count":2,"subscribers_count":2,"default_branch":"development","last_synced_at":"2025-03-31T10:22:27.776Z","etag":null,"topics":["nodejs","rest-api","sailsjs","scheduled-jobs","scheduled-tasks","scheduler","scheduler-service"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deepakpathania-zz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-04T16:04:44.000Z","updated_at":"2024-06-01T22:30:31.000Z","dependencies_parsed_at":"2023-01-31T13:31:01.323Z","dependency_job_id":null,"html_url":"https://github.com/deepakpathania-zz/Noah","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepakpathania-zz%2FNoah","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepakpathania-zz%2FNoah/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepakpathania-zz%2FNoah/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepakpathania-zz%2FNoah/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepakpathania-zz","download_url":"https://codeload.github.com/deepakpathania-zz/Noah/tar.gz/refs/heads/development","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252883386,"owners_count":21819169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","rest-api","sailsjs","scheduled-jobs","scheduled-tasks","scheduler","scheduler-service"],"created_at":"2024-10-23T15:43:15.494Z","updated_at":"2025-05-07T13:20:27.854Z","avatar_url":"https://github.com/deepakpathania-zz.png","language":"JavaScript","readme":"# Noah\n[![Build Status](https://travis-ci.org/deepakpathania/Noah.svg?branch=development)](https://travis-ci.org/deepakpathania/Noah) [![Coverage Status](https://coveralls.io/repos/github/deepakpathania/Noah/badge.svg)](https://coveralls.io/github/deepakpathania/Noah) ![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)\n\nNoah is a **scheduling service** that allows you to register tasks for making an *outbound request* after a *recurring interval*.\n- It allows you to configure the request to accept query params, headers and request body and accepts a human-readable interval to invoke the request.\n- It exposes a REST API for CRUD on schedules backed with a MySQL database for persistence. Refer to API section below for details.\n\n### Usage\nNoah is supposed to be used as a self-hosted service for your scheduling needs. Here's how you can set it up.\n1. After cloning, install the dependencies.\n\t```js\n    npm i\n    ```\n2. Create a `.env` file in the root directory and add the following environment variables.\n\n    ```\n    MYSQL_HOST\n    MYSQL_USER\n    MYSQL_PASSWORD\n    MYSQL_DB_NAME\n    MYSQL_TEST_DB_NAME\n    ```\n3. Create the databases you have specified in the `.env` file. \n\t```mysql\n    CREATE DATABASE IF NOT EXISTS MYSQL_DB_NAME;\n    ```\n   You don't need to create the tables explicitly, `sails` does that for you based on the models when you lift the server.\n\n3. Lift the server.\n    ```js\n    node app.js\n    ```\n\n4. Test whether the server was lifted properly by making a call to the health check endpoint : `{{url}}/knockknock`\n\n### API\nNoah exposes the following APIs to interact with the system.\n1. **Create Schedule** - Allows you to register a schedule with the system.\n    - Endpoint - `/v1/schedules`\n    - Method - `POST`\n    - Request Body:\n      ```js\n      {\n        \"request\": {\n          \"url\": \"{{targetUrl}}\",\n          \"method\": \"{{method}}\",\n          \"data\": {\n            \"params\": {\n                \"key\": \"value\"\n            },\n            \"headers\": {},\n            \"body\": {}\n          }\n        },\n        \"period\": {\n          \"every\": 2,\n          \"interval\": \"{{interval}}\"\n        },\n        \"start\": true,\n        \"storeResponseBody\": true\n      }\n      ```\n        - `request` is a required field. It includes the following required fields:\n            - `url` (string)- specifies the target URL to be called.\n            - `method` (string)- specifies the request method for calling the URL, eg. `GET`. \n    Accepts one of the following values `['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE']`\n            - `data` (object) - specifies the request data to be sent with the request. Send `{}` in case of no data. Each data item is an object that accepts key-value pairs.\n\n            **Note** - `body` accepts only raw format for now with json data, `application/json` header is added implicitly.\n \n        - `period` is a required field. It includes the following required fields:\n          - `every` (integer) - represents the frequency of invocation, for eg. every 2 hours.\n          - `interval` (string) - represents the time interval between invocations.\n    Accepts one of the following values `['hours', 'days', 'weeks', 'months']`\n\n        - `start` is an optional boolean field, false by default. Represents whether or not a request should be made at the time of registering the schedule.\n\n        - `storeResponseBody` is an optional boolean field, false by default. Represents whether or not the response body should be stored while making request.\n    - Returns - unique identfier for the created schedule.\n      ```js\n      {\n        \"data\": {\n          \"id\": \"88b6ba474b76df6ab866111fc3284ab0\"\n        },\n        \"meta\": {}\n      }\n      ``` \n \n2. **Update Schedule** - Allows updating the existing schedules based on their unique identifiers.\n  - Endpoint - `/v1/schedules/{{identifier}}`\n  - Method - `PUT`\n  - Request body is similar to create schedule with the following exceptions:\n    - `start` is not accepted.\n    - In case you want to edit a `request`, `storeResponseBody` or `period` field, entire object needs to be sent.\n    For example, for updating period from every 2 hours, to every 3 hours, request body would be:\n      ```js\n      {\n        \"period\": {\n          \"every\": 3,\n          \"interval\": \"hours\"\n        }\n      }\n      ```\n      **Note** Period changes would start reflecting from next cycle onwards.\n\n3. **Get all schedules** - Fetches all active schedules.\n  - Endpoint - `/v1/schedules`\n  - Method - `GET`\n  - Returns - An array of all active schedules.\n    ```js\n    {\n      \"data\": [\n        {\n          \"identifier\": \"64a623fd6b35f435dfb5fde03df2d4ed\",\n          \"nextRunningTime\": 1570435680068,\n          \"request\": {\n            \"url\": \"http://localhost:3000/v1/blogs/29\",\n            \"method\": \"GET\",\n            \"data\": {\n              \"params\": {},\n              \"headers\": {},\n              \"body\": {}\n            }\n          },\n          \"period\": {\n            \"every\": 2,\n            \"interval\": \"hours\"\n          },\n          \"storeResponseBody\": true\n        }\n      ],\n      \"meta\": {\n        \"filter\": \"active\"\n      }\n    }\n    ```\n\n4. **Get run history of schedule** - Fetches all the run histories for the specified schedule.\n  - Endpoint - `/v1/schedules/{{identifier}}`\n  - Method - `GET`\n  - Returns - An array of run history for the schedule.\n    ```js\n    {\n      \"data\": [\n        {\n          \"id\": 1,\n          \"runTime\": 1570428480068,\n          \"responseStatusCode\": 200,\n          \"responseBody\": \"hello i am a response body.\"\n        }\n      ],\n      \"meta\": {}\n    }\n    ```\n\n5. **Delete a schedule** - Marks a schedule as inactive.\n  - Endpoint - `/v1/schedules/{{identifier}}`\n  - Method - `DELETE`\n\n\n### Contributing\nPlease refer to the [issue tracker](https://github.com/deepakpathania/Noah/issues) in case you'd like to contribute. Also, feel free to open feature requests/bug reports in case you face any.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepakpathania-zz%2Fnoah","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepakpathania-zz%2Fnoah","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepakpathania-zz%2Fnoah/lists"}