Start in minutes
Install, create, serialize, and receive a message.
Get started →3.1.1 · normalize once · cross every boundary
Create a predictable { type, data } convention, omit fields a signal does not need, and load it through ESM, CommonJS, browsers, WebSockets, IPC, workers, or any JavaScript host.
js-message works with bundlers and without a bundler. Bundlers resolve the bare js-message import normally; native browser ESM resolves it through a standard import map, with no build or transpilation step.
import Message from 'js-message';
const message = new Message();
message.type = 'user.updated';
message.data = {
id: 42,
active: true
};
socket.send(message.JSON);
Choose the page you need
Each topic has a focused page, so implementation details stay close and navigation stays fast.
Install, create, serialize, and receive a message.
Get started →See every field, method, return value, and failure mode.
Open the API →Compare the tiny convention with schema validators and transport clients.
Why js-message →Understand optional fields, ignored extras, and error recovery.
Read the contract →Edit visible JavaScript and inspect each message at the boundary.
Open the playground →Inspect reproducible 3.0-to-3.1 benchmarks, charts, and raw results.
See performance →Review vanilla-test coverage, compatibility, and package checks.
Inspect testing →Install
The public module uses only JavaScript and native JSON behavior. Version 3.1.1 supports ESM and CommonJS on Node 22.13+ with zero runtime dependencies.
npm install js-message