Node.js Quickstart
Get started with Schedo.dev using Node.js
This guide will help you set up your first cloud-based scheduled job using the Schedo Node.js SDK.
Prerequisites
Before you begin, make sure you have:
- A Schedo.dev account and API key
- Node.js 16.x or later installed
- A task you want to schedule (e.g., data processing, cleanup, notifications)
Installation
Install the Schedo.dev Node.js SDK using your preferred package manager:
Create Your First Job
Create a new file called jobs.ts
(or jobs.js
if you’re not using TypeScript):
Understanding the Code
Let’s break down the key components:
-
SDK Initialization
Connects your Node.js application to Schedo.dev’s cloud platform.
-
Job Definition
Defines a job that Schedo.dev will execute according to the schedule.
-
Error Handling
Schedo.dev provides built-in error handling;
Running Your Job
-
Set your API key as an environment variable:
-
Run your job file:
Your job is now running in the cloud! Schedo.dev will:
- Execute it according to the schedule
- Prevent duplicate runs
- Provide logs and monitoring
TypeScript Support
The Schedo Node.js SDK is written in TypeScript and provides full type safety: