Urgent.News

What's breaking now, across thousands of outlets.

Tech

Building an Embedded Raft SDK for Existing Node.js Services

Sometimes an application needs Raft semantics, but it does not need another general-purpose distributed system. An existing scheduler, control plane, metadata service, or coordination service may already have its own domain model and API. What it lacks is a safe way for several instances to elect a leader, agree on an ordered command stream, and apply that stream to local state. The usual choices…

Integrating Raft consensus into an existing Node.js service is possible without overhauling the entire system. The goal of node-raft-rsm is to provide an embedded TypeScript SDK that allows an existing Node.js service to utilize Raft primitives through a focused API. This approach enables the application to maintain control over its commands, state machine, storage strategy, transport, and public API while leveraging the benefits of Raft for leader election, ordered command streams, and applying those streams to local state.

To integrate Raft, an application developer would first define the application's commands and typed results, implement a deterministic state machine for those commands, provide storage and transport adapters suitable for the deployment environment, and create a RaftNode with stable cluster membership and identity. The existing mutation paths would then be routed through node.propose(), keeping the application's HTTP, RPC, or message-based API in front of the SDK.

The SDK's public surface focuses on a few operations, such as creating a RaftNode with `RaftNode.create()`, starting the consensus process with `node.start()`, proposing commands with `node.propose()`, reading values with `node.read()`, and stopping the RaftNode with `node.stop()`. Developers can define their application's commands and results, implement state machines, and provide storage and transport adapters tailored to their deployment environment.

node-raft-rsm is currently under active development, and the current release is intended for evaluation, deterministic testing, API design, and continued implementation. The SDK does not dictate how an application should model its entities, such as accounts, jobs, locks, configuration updates, or scheduling decisions. Instead, it provides the consensus mechanism that orders those domain operations.

A concrete SDK integration example involves an existing scheduling service that already has HTTP endpoints, validation, domain types, metrics, and a local scheduler state. Each service process would create one RaftNode, with identity and membership based on a stable configuration rather than generated at startup. The repository currently includes deterministic in-memory implementations for development and testing, while production-grade durable storage and authenticated transport are still in development.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

I Tried to Put AI Into the Race. Then I Realized It Didn't Need AI.

In the previous post, I started working out what EvoWild Run is actually supposed to be as a game. Raise Creatures. Breed them. Continue their lineages across generations.

  • Initially considered controlling race creature directly, but decided against it.
  • Experimented with AI Race Agent for pre-defined commands, but deemed optional.
  • Core mechanics function without AI, Live AI unnecessary for initial version.

SMTP 250 OK Doesn't Mean Delivered. 12 of 50 Emails Bounced.

api, #cybersecurity, #webdev, #python The 250 OK Lie I Measured Last Tuesday Last Tuesday I ran a small experiment: I took 50 email addresses that had already passed two layers of validation, regex…

  • SMTP 250 OK indicates successful server handshake but doesn't guarantee delivery
  • 12 out of 50 test emails bounced despite passing initial validation
  • Validating email addresses requires considering role-based, disposable, and breached addresses

More from Tuesday 22 September →