npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@edvisor/scheduler-service-sdk

v0.0.4

Published

HTTP client SDK for the Edvisor Scheduler Service REST API

Readme

Scheduler Service

A NestJS-based microservice that handles task scheduling through AWS EventBridge Scheduler, with automatic message delivery to SQS queues when schedules trigger.

Overview

This service provides a RESTful API for managing scheduled tasks using AWS EventBridge Scheduler. It allows you to:

  • Create and manage schedule groups with dedicated SQS queues
  • Create schedules with cron or rate expressions
  • Automatically route messages to group-specific SQS queues when schedules trigger
  • Update and delete existing schedules
  • List schedules with pagination support
  • Support multiple SQS queues with flexible group-to-queue mapping

Prerequisites

  • Node.js 18+
  • AWS Account with appropriate permissions
  • AWS EventBridge Scheduler access
  • Multiple SQS queues created (one per schedule group)
  • IAM role for EventBridge to send messages to SQS

Environment Configuration

Create a .env file in the root directory:

# AWS Configuration
AWS_REGION=us-east-1
EVENTBRIDGE_ROLE_ARN=arn:aws:iam::123456789012:role/EventBridgeSchedulerRole

# AWS Credentials (choose one method)
AWS_ACCESS_KEY_ID=your-access-key-id
AWS_SECRET_ACCESS_KEY=your-secret-access-key

# SQS Queue Mappings (format: GROUP_NAME:QUEUE_URL,GROUP_NAME2:QUEUE_URL2)
SQS_QUEUE_MAPPINGS=notifications:https://sqs.us-east-1.amazonaws.com/123456789012/notifications-queue,reports:https://sqs.us-east-1.amazonaws.com/123456789012/reports-queue,tasks:https://sqs.us-east-1.amazonaws.com/123456789012/tasks-queue

# Application
PORT=3000

AWS Credential Configuration

The service supports multiple methods for AWS authentication:

Method 1: Environment Variables (Development/Testing)

Set credentials directly in your .env file:

AWS_ACCESS_KEY_ID=your-access-key-id
AWS_SECRET_ACCESS_KEY=your-secret-access-key

Method 2: AWS Credentials File (Development)

Use AWS CLI profiles instead of environment variables:

AWS_PROFILE=your-profile-name

This uses credentials from ~/.aws/credentials:

[your-profile-name]
aws_access_key_id = your-access-key-id
aws_secret_access_key = your-secret-access-key

Method 3: IAM Roles (Recommended for Production)

When running on AWS infrastructure (EC2, ECS, Lambda), no additional configuration is needed. The service will automatically use the IAM role attached to the compute resource.

Method 4: EC2 Instance Metadata

When running on EC2 instances with attached IAM roles, credentials are automatically retrieved from the instance metadata service.

Installation

$ npm install

Running the application

# development
$ npm run start:dev

# production mode
$ npm run start:prod

Testing

# unit tests
$ npm run test

# test coverage
$ npm run test:cov

API Endpoints

Create Schedule

POST /groups/{groupName}/schedules

Example request:

{
  "name": "daily-report",
  "expression": "cron(0 9 * * ? *)",
  "payload": {
    "taskType": "generate-report",
    "reportId": "123"
  },
  "startDate": "2024-01-01T00:00:00Z",
  "endDate": "2024-12-31T23:59:59Z"
}

Get Schedule

GET /groups/{groupName}/schedules/{scheduleName}

Update Schedule

PATCH /groups/{groupName}/schedules/{scheduleName}

Delete Schedule

DELETE /groups/{groupName}/schedules/{scheduleName}

List Schedules

GET /groups/{groupName}/schedules?nextToken={token}

Delete Schedule Group

DELETE /groups/{groupName}

SQS Queue Mapping

Each schedule group can be mapped to a specific SQS queue. When a schedule triggers, the message will be sent to the queue associated with that group.

Configuration

Queue mappings are configured via the SQS_QUEUE_MAPPINGS environment variable:

SQS_QUEUE_MAPPINGS=group1:queue-url-1,group2:queue-url-2,group3:queue-url-3

Error Handling

  • If a group has no specific queue mapping, schedule creation will fail with a 400 error

Examples

# Three groups with specific queues
SQS_QUEUE_MAPPINGS=notifications:https://sqs.us-east-1.amazonaws.com/123456789012/notifications-queue,reports:https://sqs.us-east-1.amazonaws.com/123456789012/reports-queue,tasks:https://sqs.us-east-1.amazonaws.com/123456789012/tasks-queue

Schedule Expression Formats

Rate Expressions

  • rate(5 minutes) - Every 5 minutes
  • rate(1 hour) - Every hour
  • rate(1 day) - Every day

Cron Expressions

  • cron(0 10 * * ? *) - Every day at 10:00 AM UTC
  • cron(0 18 ? * MON-FRI *) - Every weekday at 6:00 PM UTC
  • cron(0 8 1 * ? *) - First day of every month at 8:00 AM UTC

AWS IAM Requirements

The EventBridge role needs the following permissions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "sqs:SendMessage"
      ],
      "Resource": "arn:aws:sqs:*:*:*"
    }
  ]
}

The application needs these AWS permissions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "scheduler:CreateSchedule",
        "scheduler:UpdateSchedule",
        "scheduler:DeleteSchedule",
        "scheduler:GetSchedule",
        "scheduler:ListSchedules",
        "scheduler:CreateScheduleGroup",
        "scheduler:DeleteScheduleGroup",
        "iam:PassRole"
      ],
      "Resource": "*"
    }
  ]
}

Architecture

The service follows a clean architecture pattern:

  • Controllers - Handle HTTP requests and responses
  • Services - Contain business logic
  • AWS Services - Handle AWS SDK interactions
  • DTOs - Data validation and transformation

Error Handling

The service provides proper error responses:

  • 400 - Bad Request (invalid parameters)
  • 404 - Not Found (schedule or group doesn't exist)
  • 409 - Conflict (schedule name already exists)
  • 500 - Internal Server Error

License

This project is MIT licensed.