# Queue concepts

A Queue splits two steps: accepting work and running it. `sendQueue()` sends a
typed payload to the provider and returns when the provider accepts it. The
handler runs later, often in another process or region.

## Acceptance is not completion

`sendQueue()` tells you only that the provider accepted the job, not what the
handler returned. To show progress, put your own key in the payload, and
store the final state in [KV](https://vitehub.dev/docs/kv) or a [Database](https://vitehub.dev/docs/database).

## Delivery can happen again

Providers retry failed delivery, so a second delivery must be safe. Use an
idempotency key before you send an email, charge a card, or change a record.
See [limits and errors](https://vitehub.dev/docs/queue/limits-and-errors).

On the `node` host, the local provider stores jobs in `.vitehub/data/queue`
and runs them in the server process. Jobs survive a restart on the same disk,
but stay on one host. On Cloudflare and Vercel, the Vite plugin generates
provider output, and the provider delivers the jobs. In `vite dev`, jobs run
in the dev server with the rules of the provider. See
[Queue hosts](https://vitehub.dev/docs/queue/hosts).

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/queue.md)
- [Get started](https://vitehub.dev/raw/docs/queue/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/queue/configure.md)
- [Server API](https://vitehub.dev/raw/docs/queue/server-api.md)
- [Hosts](https://vitehub.dev/raw/docs/queue/hosts.md)
- [Limits and errors](https://vitehub.dev/raw/docs/queue/limits-and-errors.md)
- [Concepts](https://vitehub.dev/raw/docs/queue/concepts.md) (this page)

Next: [QUEUE_DRIVER_MISMATCH](https://vitehub.dev/raw/docs/queue/diagnostics/queue_driver_mismatch.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
