> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackshift.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Durable Jobs overview

> Durable Jobs is the reliable execution engine for backend work on StackShift. Deploy the app. Offload the work.

<Tip>
  **Live.** This area is documented as current, user-reliable behavior.
</Tip>

## Goal

Understand when to move backend work into Durable Jobs and what StackShift guarantees after a job starts.

## Prerequisites

* A StackShift API key
* Node.js or another backend runtime that can expose an HTTP handler

## Workflow

<Steps>
  <Step>
    Define a job handler in code.
  </Step>

  <Step>
    Start the work once with an idempotency key.
  </Step>

  <Step>
    Break longer work into steps so completed work is remembered.
  </Step>

  <Step>
    Pause for external events when the flow needs user, webhook, or payment confirmation.
  </Step>

  <Step>
    Use the run timeline, logs, attempts, and status to inspect what happened.
  </Step>
</Steps>

## What Durable Jobs is

StackShift Durable Jobs is a reliable execution engine for backend work. It runs jobs outside the request path and keeps enough durable state to retry, resume, and finish safely.

Use it for work that should not disappear when a request times out, a process restarts, or an external system is slow.

Start the work once. StackShift makes sure it completes safely.

## Short example

Start a job from an API route, webhook, or backend service. StackShift stores the run and invokes your handler.

<CodeGroup>
  ```ts Start a job theme={null}
  import { StackShift } from '@stackshift-cloud/jobs'

  const stackshift = new StackShift({
    apiKey: process.env.STACKSHIFT_API_KEY!,
  })

  await stackshift.start('send-verification-email',
    { userId: 'user_123', email: 'ada@example.com' },
    {
      queueName: 'emails',
      idempotencyKey: 'verify:user_123',
      idempotencyTtl: '30d',
    }
  )
  ```

  ```go Go theme={null}
  import stackshift "github.com/stackshiftCloud/jobs-go"

  client, err := stackshift.New(stackshift.Options{
    APIKey: os.Getenv("STACKSHIFT_API_KEY"),
  })
  if err != nil {
    return err
  }

  _, err = client.Start(ctx, "send-verification-email", map[string]any{
    "userId": "user_123",
    "email": "ada@example.com",
  }, &stackshift.StartOptions{
    QueueName: "emails",
    IdempotencyKey: "verify:user_123",
    IdempotencyTTL: "30d",
  })
  ```
</CodeGroup>

## Mental model

* Jobs execute work.
* Steps break work into durable units.
* State remembers progress across retries and resumes.
* Events let a job pause without running compute, then resume when the right signal arrives.
* Idempotency keys make duplicate starts safe.

## Expected result

<Check>
  You can explain Durable Jobs as one product concept: jobs execute work, steps divide it, state remembers progress, and events resume paused runs.
</Check>

## Related guides

<CardGroup cols={2}>
  <Card title="Quick Start" href="/durable-jobs/quick-start">
    Install the SDK, initialize a client, enqueue a job, add a worker handler, and inspect the run.
  </Card>

  <Card title="Idempotency" href="/durable-jobs/idempotency">
    Use idempotency keys so duplicate requests do not create duplicate work.
  </Card>

  <Card title="Event Waiting + Correlation" href="/durable-jobs/event-waiting-and-correlation">
    Pause a workflow until the right external event arrives, then resume the correct run.
  </Card>
</CardGroup>
