Logux synchronizes action log between peer-to-peer nodes.

You can use Logux to connect clients with a server, clients with clients, servers with servers or for mesh-networks. There is no big difference between clients and server in Logux. So we will call them nodes.

[Client 1] ⇆ [Client 2] ⇆ [Server A] ⇆ [Server B]

However, we created Logux for standard applications with multiple web and mobile clients and several servers. Next chapter read will show how core concepts work in the standard case.

Each node has action log (list of operations). When you want to change the application state, you add an action to the log. An action is a JSON object that describes what happened. Every action must have a type property.

{ type: 'user/rename' userId: 386, name: 'New name' }

Action log is append-only. You can only add actions, but can’t change or delete them. However, you can compress log by cleaning old actions, which are not actual anymore.

app.log.add(action, meta)

Each action in the log has own meta with:

Differences between action and meta:

You can use any method to connect Logux nodes. Logux uses WebSocket only as default way. You can replace connection class to own implementation.

During the synchronization Logux guarantee:

Logux is based on the Optimistic UI idea. When a node creates action, it applies it immediately to own application state. In the background, Logux will synchronize this new action with other nodes.

When node synchronizes action to another node, the next node will apply the action and synchronize action to other nodes.

Logux is based on the offline-first idea. If the node is offline right now, new actions will wait for a connection in the node’s log. Offline is a standard mode for Logux application.