Skip to Content
Runlane
Get started

Choose a lane

Pick where Runlane stores runs and how workers find new work.

With createLocalLane(), runlane dev owns the runs in its memory. The app, CLI, and worker reach that store over a loopback bridge: a token-protected connection that only accepts traffic from your own machine (127.0.0.1). The app never keeps runs in its own memory. Without dev, the first trigger or read fails with storage_unavailable. Start dev and retry; no app restart is needed.

A lane is the setup behind your Runlane runtime. It answers two questions:

  • Where are runs stored?
  • How do workers find out about new work?
lane = storage + delivery

You pick one lane for the whole runtime. Tasks do not pick their own. Your task and trigger code stays the same on every lane, so you can start local and switch later.

Quick pick

If you areUsePackage
DevelopingcreateLocalLane()@runlane/lane-local
Testing in one processcreateTestLane()@runlane/lane-local
Running always-on workers in productionPostgres polling@runlane/lane-postgres-polling
Running workers on AWS Lambda or as SQS consumersPostgres and SQS@runlane/lane-postgres-sqs
Using Redis or Valkey with direct worker claimsRedis polling@runlane/lane-redis-polling
Using Redis or Valkey for state and queued wakeupsRedis Streams@runlane/lane-redis-streams
Using Redis or Valkey with SQS consumersRedis and SQS@runlane/lane-redis-sqs
Running tasks in your app's own HTTP routeHTTP push@runlane/lane-postgres-http or @runlane/lane-redis-http

Not sure? Start with the local lane. Move to Postgres polling when runs must survive a restart. HTTP push pairs Postgres or Redis storage with signed HTTP delivery. See HTTP push.

Compare lanes

LocalPostgres pollingPostgres and SQSRedis pollingRedis StreamsRedis and SQSHTTP push
Stores runs inDev process memoryPostgresPostgresRedis or ValkeyRedis or ValkeyRedis or ValkeyPostgres, Redis, or Valkey
Workers find work byPolling devPolling and hintsSQS messagesPolling and hintsStream messagesSQS messagesSigned POSTs to your route
Runs survive a restartNoYesYesDepends on persistence settingsDepends on persistence settingsDepends on persistence settingsSame as its storage
Services you runrunlane devPostgresPostgres and SQSRedis or ValkeyRedis or ValkeyRedis or Valkey and SQSStorage and an HTTPS route
Lambda workersNoScheduled drainNative SQS handlerScheduled drainNo native handlerNative SQS handlerFunction URL with a fetch bridge

Choose Postgres when it fits your database operations and SQL tooling. Choose Redis when you already operate Redis or Valkey and can fit each namespace's memory and write traffic on one primary. Cluster spreads independent namespaces across slots; it does not divide a namespace among primaries. Both providers include operator reads, leases, waits, and schedules. Review the Redis startup checks and durability boundary.

Redis and SQS uses the same native SQS handler as Postgres and SQS, through redisSqsLane() from @runlane/lane-redis-sqs.

Where Runlane runs

Producers accept work with trigger(). Workers execute tasks. Maintenance moves due work forward and recovers interrupted runs. These roles can run on different hosts with the same lane configuration.

RoleLong-running Node process or containerAWS LambdaOther serverless functionsEdge runtimes
Producer (calls trigger())SupportedSupportedWorks but has no guideNot supported
Worker (runs tasks)SupportedSupported (SQS with Postgres or Redis storage, or a scheduled polling drain)Supported through HTTP push with explicit in_request lifetime, or a scheduled Postgres or Redis polling drain. A drain's latency follows the timer interval. Each run must finish within the function timeoutNot supported
MaintenanceSupportedSupported (scheduled Lambda)Supported in the same scheduled functionNot supported

All supported hosts need Node.js 22.18+ and access to the lane's services. Production producers need reachable storage; a transport lane also needs access to its broker. SQS requires AWS credentials and SQS access. A serverless producer can use Postgres or Redis storage while workers run elsewhere. On ready-made lanes, set runHints: false in serverless processes to disable run-progress hints. A raw Redis composition leaves them disabled by default. On Postgres polling, only a long-running worker opens the dedicated worker wake-up connection, on top of the storage pool. Producers, maintenance, and drain() do not open it. Count it in each long-running worker process's connection budget. The Postgres + SQS lane opens no worker wake-up listener.

“Works but has no guide” means the Node.js entry point can run within a function invocation. For maintenance, export const handler = runlane.createMaintenanceHandler() directly on a recurring schedule. It starts lazily. For scheduled polling workers, export runlane.createDeliveryHandler({ maxDuration: '50s' }); it runs maintenance and drains due work. Check the host's timeout and connection limits.

Long-running workers use createDeliveryWorker(). Scheduled polling workers use createDeliveryHandler({ maxDuration: '50s' }). SQS Lambda workers use the lane's native createDeliveryHandler() and must finish within the invocation limit. The SQS handler accepts SQS Lambda events. HTTP delivery uses a fetch handler from @runlane/transport-http, with a required lifetime choice. Edge runtimes need non-Node support that Runlane does not provide.

See Deploy to AWS for Lambda, Fargate, and scheduled maintenance; Postgres polling for a long-running process; and the Hono recipe for request-side triggers.

Local lane

app, CLI, scripts ──> runlane dev (memory + worker)

Use createLocalLane() for Node.js development. Runs live in dev's memory and are gone when dev stops. Use createTestLane() for in-process tests without dev.

In an app, run two terminals:

  1. Start runlane dev. It holds the runs and runs the worker.
  2. Start your app. It finds the dev process and shares its runs.

runlane dev reloads your task code when you save. Runs that are already going finish on the old code.

Keep in mind:

  • No dev, no accepted run. The first trigger fails. Start dev and retry in the same app process.
  • Tests use a test lane. Call drain() or executeNext() on a runtime built with createTestLane(). Same-name test lanes share memory until the last handle closes.
  • Restarting dev clears every run.
  • Development on Node.js. In production, use Postgres or Redis storage. The Postgres and Redis SQS lanes supply native AWS Lambda delivery.

See run local development for how the app finds dev, and reload task code for what happens on save.

Postgres polling

producer ── writes run ──────> Postgres
worker   ── polls, claims ───> Postgres
Postgres ── wake-up signal ──> worker

Use postgresPollingLane() when your workers run all the time and can connect to Postgres. This is the smallest production setup. There is no message broker.

Postgres stores each run and decides which worker gets it. When new work arrives, Postgres sends a quick signal so idle workers wake up sooner. If a signal is lost, the next poll still finds the work.

Postgres and SQS

producer
   │
   ▼
Postgres (run + outbox)
   │
   ▼
publisher ──> SQS ──> worker
                        │
                        ▼
                     Postgres

Use postgresSqsLane() when SQS should wake your workers, such as AWS Lambda functions or long-running SQS consumers. Postgres still stores the runs. An SQS message only tells a worker which run to check.

A duplicate or late SQS message does not create a second run. The worker reads the run from Postgres before it does anything.

Redis polling and Streams

Use Redis polling for direct storage claims. Pub/sub hints reduce idle waits, and polling finds work after a missed hint. This lane can also drain work in a scheduled function.

Use Redis Streams when long-running consumers should receive queued wakeups. Storage still decides which worker owns a run. Each transport namespace uses one fixed consumer group per logical queue. For Lambda, use Redis and SQS.

Standalone, Sentinel, and Cluster are supported. Use noeviction; an observed allkeys-* policy fails startup. Check the endpoint's command, routing, eviction and request-size requirements.

HTTP push

producer ── writes run + outbox ──> storage
publisher ── signed POST ─────────> your route
your route ── claims run ─────────> storage ── replies 202

Use @runlane/transport-http when Runlane should wake a route in your own app instead of a queue service. The POST only says which run to check. Storage still holds the run, decides who owns it, and keeps the pending wakeup until it is sent.

Use postgresHttpLane() or redisHttpLane(). lifetime is required. in_request works on every supported host; the sending request and await runlane.trigger() wait for the attempt. Set publishTimeout above maxDuration plus settlement. Nested child publication needs maxConcurrentPublishes above concurrent in-request parents, with spare incoming and queue capacity; otherwise avoid nested triggers in these handlers. process replies 202 after claim and keeps running in the app process, so use it only on long-lived servers. Serverless background replies require a host lifetime callback such as after or waitUntil.

Each POST is signed with a shared secret. Runlane retries a failed POST from storage, and maintenance recovers a run whose wakeup never arrived. Because HTTP itself keeps no copy, the composed lane reports productionDurable: false. Run maintenance on a schedule, and limit execution with queue concurrency. Edge runtimes are not supported. Follow HTTP delivery for setup, secret rotation, and host guidance.

What production lanes need

Production lanes need:

  1. Compatible storage. Apply Postgres migrations before the new app version starts. Redis startup initializes an empty namespace with a format marker and rejects incompatible markers; there is no Redis migration CLI.
  2. Maintenance. It starts scheduled runs, wakes runs whose wait or retry delay has ended, and recovers work from crashed workers. It also finishes cancellations and sends pending SQS messages. runlane work runs it inside a worker by default. With Lambda workers, run it on a schedule instead.
  3. Compatible setup. Producers and workers use the same environment and queue definitions, with compatible task schemas. Keep maintenance running for every scheduled task. Processes with the same declared schedule IDs share one schedule owner; processes with different scheduled tasks each create runs for their own.

Before you go live, also read make side effects safe to repeat and change tasks safely.

Next steps

On this page