Duron
A powerful, type-safe job queue system for Node.js and Bun.js
Duron is a powerful, type-safe job queue system built for Node.js and Bun.js. It provides a robust way to manage background jobs, handle concurrency, retries, and more.
Features
- Type-Safe - Full TypeScript support with Standard Schema validation (Zod, Valibot, ArkType)
- Flexible - Support for multiple database backends (PostgreSQL, PGLite)
- Reliable - Built-in retry logic and error handling
- Scalable - Multi-process support and concurrency control
- Observable - Track jobs and steps with detailed status information
- Simple - Easy-to-use API with sensible defaults
Dashboard
Duron comes with a built-in dashboard for real-time job monitoring and management.
Job List
Job Output
Timeline View
Quick Start
import { duron } from 'duron'
import { defineAction } from 'duron/action'
import { pgliteAdapter } from 'duron/adapters/pglite'
import { z } from 'zod'
const sendEmail = defineAction()({
name: 'sendEmail',
input: z.object({
to: z.string().email(),
subject: z.string(),
body: z.string(),
}),
handler: async (ctx) => {
// Use steps to break down work into retryable units
await ctx.step('sendEmail', async ({ signal }) => {
console.log(`Sending email to ${ctx.input.to}`)
// Your email sending logic here
// The signal can be used to handle cancellation
const response = await fetch('https://api.email.com/send', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(ctx.input),
signal,
})
if (!response.ok) {
throw new Error('Failed to send email')
}
})
return { success: true }
},
})
const client = duron({
database: pgliteAdapter({ connection: ':memory:' }),
actions: { sendEmail },
})
await client.start()
const jobId = await client.runAction('sendEmail', {
to: 'user@example.com',
subject: 'Hello',
body: 'This is a test email',
})Documentation
Getting Started
Learn how to get started with Duron
Upgrading
Breaking and behaviour changes, and what to change
Actions
Learn how to define and use actions
Jobs and Steps
Understand how jobs and steps work
Client API
Complete reference for the Duron Client API
Server API
Create HTTP API endpoints for Duron
Dashboard
Monitor and manage jobs in the browser
Adapters
Learn about database adapters
Telemetry
Trace jobs and steps with OpenTelemetry
Retries
Configure retries for actions and steps
Error Handling
Learn how to handle errors in Duron
Multi-Worker Setup
Run several worker processes on one database
How it works
Guarantees behind discovery, recovery and shutdown
Examples
Real-world examples and use cases