Skip to main content
Orionjs 4.6 let you call Rust libraries from JavaScript through @orion-js/native. Orionjs 5.0 turns the model around: a Rust binary (orionrs) can be the host process of your app. The Rust host owns the public HTTP port, the background job scheduler, and the Pulse event consumers. Routes, jobs, and echoes declared in Rust run in Rust; everything else goes to your Orionjs app, which keeps running in Bun or Node behind a private unix socket. Moving a controller to Rust is a local change—declare it in Rust, and the JS worker stops receiving it. The Rust host is opt-in. Without it, a v5 app runs the same way as v4. All @orion-js/* npm packages and orionrs* crates are aligned at 5.0.0.

Why the host has to be Rust

When Node or Bun is the host, every HTTP request, job claim, and Pulse event passes through the JavaScript event loop first. Calling native code helps for CPU-bound functions, but the event loop remains the ceiling for everything that enters the process. With Rust in front (built on tokio, tower, and axum), migrated controllers never touch Node. On examples/backend-base, measured with ab (keep-alive, 50 connections): The Rust number is probably limited by ab itself. Proxying a route that still lives in Node costs about 12%, which is what you pay until you move it.

Migrate whole flows, one controller at a time

Rust does not call into your JS services. Instead, you migrate complete flows—a route, the job it schedules, the event that job publishes—one controller at a time. Everything not yet declared in Rust falls back to the Orionjs worker over a private unix socket (ORION_HOST=rust, ORION_HOST_SOCKET, and a per-process ORION_HOST_TOKEN):
  • HTTP routes: Rust routes are plain axum handlers. Error::user, Error::validation, Error::auth, and internal errors (?) return the same JSON payloads and SHA-1 hashes as @orion-js/http, and Jwt<Claims> verifies Authorization: Bearer tokens using jwt_secret from your env file. Unmatched paths—and unmatched HTTP methods on a path partially moved to Rust—are proxied to Node.
  • Jobs: With .jobs(...), orionrs-jobs runs the claim loop, adaptive index hint probe, and partition reconciler against the same @orion-js/dogs collections. Jobs defined in Rust run in Rust; jobs defined only in JS are claimed by the host and dispatched to Node through jobs.execute and jobs.filter, keeping JS options like onError, onStale, getNextRun, executionGuard, canTakeJobs, and getJobsFilter. startWorkers() in your app stays unchanged—under the host it registers jobs instead of polling. If a job is defined in both, Rust wins.
  • Echoes: With .echoes(...) and .pulse(...), orionrs-echoes consumes events with orionrs-pulse (a Rust port of @orion-js/pulse) and handles POST /echoes-services. Rust echoes run in Rust; JS event echoes are delivered to Node via echoes.deliver with the same retries and dead letters, and JS request echoes are forwarded to the app. If you omit .pulse(...), the host handles Rust request echoes while the app keeps consuming its own Pulse events.
  • Env and MongoDB: orionrs-env reads the same encrypted orion-env YAML file (both post-quantum pq1: and legacy formats), and orionrs-mongo connects with the official MongoDB driver using Orionjs typed_id, random_id, and BSON/ISO date helpers.
The host also owns the worker’s lifecycle. In production it runs your built bundle; in development you can override the command with ORION_NODE_COMMAND="bunx orion dev" so orion dev restarts Node on file changes while the host keeps the port open and holds incoming requests until Node is back. On SIGTERM, the host drains active requests, jobs, and events across both runtimes before stopping Node’s process group. If Node exits on its own, the host exits with an error so your orchestrator restarts both.

Compatible with v4 during rolling deploys

Other than the Kafka removal below, v5 keeps the same storage schemas and wire formats as v4:
  • Jobs use orionjs.jobs_dogs_records and orionjs.jobs_dogs_history with the same claim and lock protocol.
  • Pulse uses the same collections, leases, and delivery states.
  • Echoes requests (/echoes-services) use the same signature and serialization format.
v4 workers and v5 hosts can share job queues, Pulse consumer groups, and synchronous Echoes calls side by side while you roll out an upgrade.

Breaking change: Kafka is removed from Echoes

@orion-js/echoes now uses Pulse as its only event transport, which requires nothing beyond MongoDB. Top-level client, producer, and consumer, events.kafka, events.consumeFrom, events.publishTo, onMessage, and publish()’s acks / timeout options have been removed. events.pulse is unchanged. If you still consume or publish through Kafka, switch to Pulse on Orionjs v4 first—v4 can consume from both Kafka and Pulse during the transition—using the v4 incremental Kafka-to-Pulse guide, then follow Upgrading to v5. The full v4 documentation stays available under the v4 option in the version switcher.

Try it

A minimal host sits in a server/ crate next to your Orionjs app:
Run it locally with your existing ORION_ENV_FILE_PATH and ORION_ENV_SECRET_KEY:
Read the Orion v5 guide for routes, jobs, echoes, and deployment details, or check out examples/backend-base to see a flow that crosses Rust and JavaScript four times (POST /examples in Rust → example.created in JS → processExample job in JS → example.processed in Rust) along with end-to-end tests (bun run e2e) that boot the real host binary.