DEV Community

Alex Spinov
Alex Spinov

Posted on

Hatchet Has a Free API You've Never Heard Of

Hatchet is a distributed task queue and workflow engine. Think Celery + Temporal combined — with a beautiful dashboard, retries, rate limiting, and concurrency control built in.

What Makes Hatchet Special?

  • Workflow engine — define multi-step workflows in code
  • Rate limiting — built-in per-key rate limits
  • Concurrency control — limit parallel executions
  • Retries — automatic with exponential backoff
  • Dashboard — real-time monitoring UI
  • Free tier — self-host or use Hatchet Cloud

The Hidden API: Workflow Definitions

import Hatchet from '@hatchet-dev/typescript-sdk';

const hatchet = Hatchet.init();

// Define a workflow
const orderWorkflow = hatchet.workflow({
  id: 'process-order',
  description: 'Process an e-commerce order',
  on: { event: 'order:created' }
});

orderWorkflow.step('validate', async (ctx) => {
  const order = ctx.workflowInput();
  if (order.total > 10000) {
    throw new Error('Order requires manual review');
  }
  return { validated: true, orderId: order.id };
});

orderWorkflow.step('charge-payment', async (ctx) => {
  const { orderId } = ctx.stepOutput('validate');
  const charge = await stripe.charges.create({
    amount: ctx.workflowInput().total,
    currency: 'usd'
  });
  return { chargeId: charge.id };
}, {
  retries: 3,
  timeout: '30s'
});

orderWorkflow.step('send-confirmation', async (ctx) => {
  const { orderId } = ctx.stepOutput('validate');
  const { chargeId } = ctx.stepOutput('charge-payment');
  await sendEmail(ctx.workflowInput().email, { orderId, chargeId });
  return { sent: true };
});
Enter fullscreen mode Exit fullscreen mode

Rate Limiting API

const apiWorkflow = hatchet.workflow({
  id: 'api-call',
  on: { event: 'api:request' },
  concurrency: {
    maxRuns: 10,              // Max 10 concurrent runs
    limitStrategy: 'QUEUE'    // Queue excess runs
  }
});

apiWorkflow.step('call-external', async (ctx) => {
  // Rate limited automatically
  return await fetch(ctx.workflowInput().url).then(r => r.json());
}, {
  rateLimits: [{ key: 'external-api', units: 1 }] // 1 unit per call
});
Enter fullscreen mode Exit fullscreen mode

Trigger API

// Trigger from anywhere
await hatchet.event.push('order:created', {
  id: 'ord_123',
  email: 'customer@example.com',
  total: 4999
});

// Schedule for later
await hatchet.workflow.trigger('process-order', {
  input: { id: 'ord_456' },
  scheduledAt: new Date('2026-04-01')
});
Enter fullscreen mode Exit fullscreen mode

Quick Start

npm install @hatchet-dev/typescript-sdk
# Get token from https://cloud.onhatchet.run
Enter fullscreen mode Exit fullscreen mode

Why Teams Choose Hatchet

A developer shared: "We had Bull + Redis for job queues with hand-rolled retry logic and no visibility. Hatchet gave us workflows, automatic retries, rate limiting, and a dashboard to see everything running. Setup took 30 minutes."


Building background jobs? Email spinov001@gmail.com or check my tools.

How do you handle background tasks? Hatchet vs Temporal vs Inngest?

Top comments (0)