Skip to content
pushqdocs
Get started

This production checklist lists what to set up before real traffic goes through pushq, whether you use the hosted API or run your own server. Each item is one or two lines with a link to the page that has the details. The self-hosting items are at the end.

Most of the app-side work fits in a few lines: one shared client with its API key read from the environment and a timeout set, plus a deterministic task_id so that a retried enqueue can’t create a duplicate.

import { Pushq, PushqError } from "pushq";
// Create one client at startup and reuse it.
export const pq = new Pushq({ apiKey: process.env.PUSHQ_API_KEY, timeoutMs: 10_000 });
export async function enqueueWelcome(userId: number) {
try {
await pq.createTask("emails", {
taskId: `welcome-user-${userId}`,
path: "/hooks/send-welcome",
jsonBody: { userId },
});
} catch (err) {
if (err instanceof PushqError && err.code === "already_exists") return; // already enqueued
throw err;
}
}

Field names on this page are the JSON names (rate_limits.max_dispatches_per_second). The SDKs use their language’s casing: camelCase in TypeScript and Java, snake_case in Python, PascalCase in Go and .NET.

Load the key from an environment variable such as PUSHQ_API_KEY, set by your secret manager or deployment platform, and keep it out of source control. The SDKs don’t read environment variables themselves, so pass the key explicitly. Never ship a key to a browser or mobile app. See store keys safely.

Use writer keys in app code, admin keys for tooling

Section titled “Use writer keys in app code, admin keys for tooling”

A writer key can enqueue tasks and manage queues it knows by name, but can’t list or delete queues or manage keys. That is all most services need. Keep admin keys for people and ops tooling, and give each service and environment its own key. See API key roles.

pushq accepts any number of keys at once: create the new key, deploy it, wait until the old key’s last_used_at stops moving, then revoke the old one. See rotate a key with zero downtime.

Set target.signing_secret on each queue so every delivery carries Standard Webhooks webhook-id, webhook-timestamp and webhook-signature headers. Generate a fresh secret per environment, for example echo "whsec_$(openssl rand -base64 32)". See the target settings.

Reject any request whose signature doesn’t verify, and verify the body exactly as received, before any JSON parsing. A framework that parses and re-serializes the body breaks verification. Every SDK ships a verifier; see verify signatures.

Delivery is at least once: a timeout, a crash or a lost lease can deliver the same task again. Use the webhook-id header (<queue>/<task_id>, stable across retries) or X-Pushq-Task-Id as an idempotency key. See idempotent handlers and delivery guarantees.

pushq retries every non-2xx response, including 400 and 404. If your handler knows a task is permanently bad, record the problem and return a 2xx to stop the retries. See what counts as a failure and stop retrying a task.

Deduplicate with a task ID and treat already_exists as success

Section titled “Deduplicate with a task ID and treat already_exists as success”

Build task_id from your own record ID. A second create with the same ID returns 409 already_exists, which means the task is already queued, so treat it as success (as in the example above). The ID stays reserved after the task finishes: 24 hours after success and 7 days after failure by default. See task IDs and deduplication and the deduplication pattern.

No SDK retries API calls on its own. Network errors and timeouts surface as the HTTP library’s own exceptions rather than the pushq error type (in Java, as a PushqException with status 0), so handle both and retry with backoff. Because of task_id, retrying a create is safe. See error handling.

Create the client once at startup and share it, rather than building one per request, so connections are reused. The default request timeout is 30 seconds; lower it if an enqueue sits on a user-facing request path. See SDK client options.

POST .../tasks:batch returns 200 even when some items fail. Each item has its own task or error (already_exists, invalid_argument, …), so inspect every result. See batch enqueue and the bulk enqueue pattern.

Use PATCH for single changes; PUT replaces the whole queue config

Section titled “Use PATCH for single changes; PUT replaces the whole queue config”

Keeping the full config in code and upserting it at deploy time works well. See create or update a queue with PUT and update part of a queue.

Choose rate limits your endpoint can handle

Section titled “Choose rate limits your endpoint can handle”

The defaults are 500 dispatches per second and 1,000 concurrent requests per queue, more than most endpoints can absorb. Set max_dispatches_per_second and max_concurrent_dispatches to what the receiving service (or the third-party API behind it) can take, and answer 429 with Retry-After when overloaded. See the rate limits guide and throttle a third-party API.

By default a task gets 100 attempts and keeps retrying for about 3.5 days. Lower max_attempts for work that goes stale, and raise min_backoff_seconds to a few seconds if failures usually mean a deploy or an outage. When you set both max_attempts and max_retry_duration_seconds, retries stop only when both are reached. See retry backoff and when retries stop.

Set dead_letter_queue so tasks that run out of retries are copied somewhere you can inspect and replay them. Create the dead-letter queue itself first, with its own target.base_url if your tasks use relative paths: if it doesn’t exist, the copy fails and is only logged. See dead-letter queues and replay dead letters.

Match the dispatch deadline to handler time

Section titled “Match the dispatch deadline to handler time”

Each attempt waits up to dispatch_deadline_seconds (default 600, range 15 to 1800) for a response; past that it counts as a timeout and is retried, even if your handler finishes later. Set it above your slowest handler’s time, or acknowledge quickly and do slow work elsewhere. See dispatch deadline and long-running work.

GET /v1/queues/{queue}/stats returns pending, running, failed, scheduled_future, oldest_due_age_seconds and error counts for the last minute and hour. Alert when oldest_due_age_seconds keeps growing (a backlog) or errors_last_1m climbs. See queue stats and the dashboard.

GET /metrics serves Prometheus counters for dispatch results, errors by kind, latency, in-flight deliveries, retries and dead-lettered tasks. They are aggregate, without per-queue labels; use the stats endpoint for per-queue numbers. See Prometheus metrics.

Close the unauthenticated first-run window

Section titled “Close the unauthenticated first-run window”

A new server with no api_keys and no dashboard accounts accepts every request without credentials. Create the first admin account (or set api_keys) before the server is reachable from anywhere else. See create the first admin account. Never expose a pushq dev server.

Run two replicas on Postgres for high availability

Section titled “Run two replicas on Postgres for high availability”

SQLite is single-node. With Postgres, run two or more replicas: all serve the API, one holds the dispatcher lock, and another takes over if it dies. Probe /healthz for liveness and /readyz for readiness. See high availability and leader election and deploy with docker-compose.

Bind pushq to a private address and put a TLS-terminating proxy in front. The proxy must send X-Forwarded-Proto: https so the session cookie is marked Secure, and must allow request bodies up to 8 MiB for batch enqueues. See reverse proxy setup.

Queue names with folders travel as one encoded segment (/v1/queues/user%2Finstagram). If the proxy decodes %2F into /, pushq answers 404. With nginx, write proxy_pass with no URI part. See forward the path unmodified.

/metrics is public by default and lists aggregate numbers for the whole server. Set metrics.public: false (PUSHQ_METRICS_PUBLIC=false) to require an admin key, or block it at the proxy. See metrics settings.

All state lives in the database: queues, tasks, accounts and API keys. Use sqlite3 .backup or pg_dump (or managed Postgres snapshots), and back up before every upgrade, since there are no down migrations. See backups and upgrading.

Succeeded tasks are kept 24 hours and failed tasks 7 days by default, never less than the 1-hour dedup window. Longer retention gives you more history but more rows to scan. See retention and cleanup.

Run an exact image tag or release binary in production so upgrades happen when you choose. :edge moves on every release. See upgrading pushq.