/ElysiaCronyx

A plugin to harness the power of Cronyx's script-based task scheduling in your Elysia applications.

Primary LanguageTypeScriptMIT LicenseMIT

ElysiaCronyx npm version CI/CD

A plugin to harness the power of Cronyx's script-based task scheduling in your Elysia applications.

🌟 Features

icon

Integrate Cronyx directly with Elysia applications and enable a world of seamless task scheduling.

🚀 Getting Started

Installation

Install the Cronyx and ElysiaCronyx plugin using bun:

$ bun add cronyx elysia-cronyx

Integration with Elysia

For integration with the Elysia web framework:

// MysqlJobStore, PostgresJobStore and RedisJobStore are also available for the integration
import { MongodbJobStore } from "cronyx";
import cronyx from "cronyx-server";
import Elysia from "elysia";

const jobStore = await MongodbJobStore.connect("mongodb://mongo:27017/db");
const app = new Elysia().use(cronyx({ jobStore })).listen(3000);
console.log(`CronyxServer is running at ${app.server?.hostname}:${app.server?.port}`);

⚙️ Configuration

  • jobStore: BaseJobStore - Cronyx's job store instance.
  • timezone? (optional): string - Defaults to local timezone if not provided.

💻 Development

Using Visual Studio Code and the Dev Containers extension, you can simplify the development environment setup process. The extension allows you to develop inside a Docker container and automatically sets up the development environment for you.

  1. Install the Dev Containers extension in Visual Studio Code.

  2. Clone the repository:

git clone https://github.com/yujiosaka/ElysiaCronyx.git
  1. Open the cloned repository in Visual Studio Code.

  2. When prompted by Visual Studio Code, click "Reopen in Container" to open the project inside the Docker container.

  3. The extension will build the Docker container and set up the development environment for you. This may take a few minutes.

  4. Build and run the Docker container with Docker Compose:

$ docker-compose up --build

This will start testing in watch mode.

🐞 Debugging tips

Enable debug logging

Job status changes are logged via the debug module under the cronyx:elysia namespace.

env DEBUG="cronyx:elysia" bun server.js

💳 License

This project is licensed under the MIT License. See LICENSE for details.