All Templates / Automation
Nodejs Cron Scheduler
Simple Cron Job Scheduler that uses Node.js and environment variables
nodejs-cron
tsykin/nodejs-cron
Just deployed
A utility for scheduling multiple cron jobs using environment variables and node-cron
.
The following environment variables are supported:
Variable | Required | Description | Example |
---|---|---|---|
TIMEZONE | No | IANA timezone name (defaults to UTC) | TIMEZONE="America/New_York" |
RUN_ON_START | No | Run jobs on startup (defaults to false ) | RUN_ON_START="false" |
JOB{n} | Yes | Cron job configuration (see below) | JOB1="* * * * *::GET::https://api.example.com" |
Environment Variable Formatting Rules. Since some environment variables have to contain spaces or special characters, it's recommended to use double quotes for all values.
Development configuration. During development or testing you can set RUN_ON_START="true"
to run jobs on every file change to see result of changes faster.
The scheduler supports all IANA timezone names. Examples:
TIMEZONE"="UTC"
(default)TIMEZONE"="America/New_York"
TIMEZONE"="Europe/London"
TIMEZONE"="Asia/Tokyo"
Note, that timezone is configured for all jobs.
See list of available timezones here.
Jobs are configured using environment variables in the following format:
JOB{n}="schedule::method::url::prop1=value1::prop2=value2"
Where:
{n}
: Job number (1, 2, 3, etc.)schedule
: Cron schedule expressionmethod
: HTTP method (GET, POST, PUT, DELETE, PATCH)url
: Target URLprop{n}=value{n}
: Optional properties for request bodyFields are separated by ::
(double colon).
JOB1="* * * * *::GET::https://api.example.com/ping"
JOB2="0 0 * * *::POST::https://api.example.com/daily-task"
JOB1="0 0 * * *::POST::https://api.example.com/task::userId=123::action=backup"
This will send a POST request with the body:
{
"userId": "123",
"action": "backup"
}
JOB1="*/5 * * * *::GET::https://api.example.com/health"
JOB2="0 0 * * *::POST::https://api.example.com/daily::task=backup"
JOB3="0 */2 * * *::PUT::https://api.example.com/update::status=active"
The scheduler includes comprehensive validation for all configuration:
If validation fails, the scheduler will:
In order to test your configuration you can use these services that quickly mock API endpoints:
Licensed under the MIT license.
All PRs are welcome :)
Template Content
nodejs-cron
tsykin/nodejs-cronJOB1
Cron job configuration according to template
Details
tsykin
Created on Apr 21, 2025
0 total projects
TypeScript, JavaScript, Dockerfile
Automation
More templates in this category
Postgres S3 backups
A simple NodeJS app to back up your PostgreSQL database to S3 via a cron
Railway Templates
820
Tier
A single tool to configure,orchestrate and manage your entire pricing stack
beuz's Projects
17
Trigger.dev
Open source background jobs framework for TypeScript.
Jan Henning's Projects
121