OqronKitOqronKit

Installation

Install OqronKit and configure your project

Installation

Install OqronKit with your preferred package manager:

npm install oqronkit

Project Configuration

Initialize Oqron by passing configuration options inline when instantiating the Oqron class:

index.ts
import { Oqron } from "oqronkit";

const oqron = new Oqron({
  mode: "redis-postgres",
  redis: "redis://localhost:6379",
  postgres: "postgresql://localhost:5432/mydb",
  project: "my-app",
  environment: process.env.NODE_ENV ?? "development",
  logger: { level: "info" },
});

// Boot persistence + module engines
await oqron.start();

Configuration Options

OptionTypeDescription
mode'memory' | 'redis' | 'redis-postgres'Core persistence mode (monolith vs distributed)
redisstring | RedisConfigRedis connection info (required for redis and redis-postgres modes)
postgresstring | PostgresConfigPostgreSQL connection info (required for redis-postgres mode)
projectstringUnique project identifier for key prefixing (default: 'default')
environmentstringIsolation environment namespace (default: 'development')
loggerLoggerConfig | falseStructured logger control
disableModulesstring[]Explicitly disable built-in modules

Logger Configuration

// Custom log level and disabling internal engine logging
logger: {
  level: 'info',
  internal: false, // Turn off OqronKit's internal logs, keep only user logs
}

// Disable logging entirely
logger: false

Definition Registration

OqronKit uses a self-registering factory pattern. You define your background assets (queues, crons, workers) by calling their respective factories globally. Because these factories register their configurations under the hood upon module evaluation, you must import your definition files before invoking oqron.start().

Basic Registration

triggers/jobs.ts
import { Queue, Cron } from "oqronkit";

export const emailQueue = Queue<{ to: string; body: string }>({
  name: "send-email",
  handler: async (ctx) => {
    // processing logic
  },
});

export const dailyCleanup = Cron({
  name: "daily-cleanup",
  expression: "0 0 * * *",
  handler: async (ctx) => {
    // cleanup logic
  },
});
index.ts
import { Oqron } from "oqronkit";

// 1. Import definition files so they register globally
import "./triggers/jobs.js";

// 2. Instantiate and start Oqron
const oqron = new Oqron({ mode: "memory" });
await oqron.start();

Module Selection

OqronKit is extremely lightweight. Module engines are automatically enabled only if at least one definition is registered for them (used = enabled).

If you want to explicitly prevent specific modules from starting (e.g. running a worker process that should never run cron triggers, or vice-versa), you can list them in disableModules:

const oqron = new Oqron({
  mode: "redis",
  redis: "redis://...",
  disableModules: ["cron", "schedule"], // Never boot schedulers on this node
});

Environment Isolation

OqronKit enforces strict environment isolation. A production worker will never accidentally claim development tasks. All keys are prefixed:

${project}:${environment}:${job_name}

Next Steps

  • Quick Start — Build your first queue in 2 minutes
  • Architecture — Understand the core design principles
  • Adapters — Deep-dive into adapter configuration

On this page