Skip to content
sovereignbasePublic

About

A causality-encoding engine written in TypeScript and C++ to build high-performance, conflict-free replicated data types for the web.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

999 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version JSR CI codecov license

Sequencer

Sequencer provides a total order guarantee for distributed editing. It allows independently operating actors to make concurrent edits and eventually converge on the same state without relying on network arrival order or perfectly synchronized clocks.

Note

A major update simplifying the public API is coming soon, once all planned features for version 1.x are implemented. This includes attachment support (introduced in v1.3.0), remote data validation, and potentially other features.

Contents

Projection

Usage

import { Projection } from '@sovereignbase/sequencer'

const projectionA = new Projection<string>(1)

const projectionB = new Projection<string>(2)

const insertDelta = projectionA.insert(['Hello World'], 0)
console.log(projectionA.value(0)) // "Hello World"

projectionB.apply(insertDelta)
console.log(projectionB.value(0)) // "Hello World"

const replaceDelta = projectionA.replace(['Hello Dude'], 0, 0)
console.log(projectionA.value(0)) // "Hello Dude"

const replaceAcknowledgement = projectionB.apply(replaceDelta)
console.log(projectionB.value(0)) // "Hello Dude"

projectionA.apply(replaceAcknowledgement?.[1])

const removeDelta = projectionA.remove(0, 0)
console.log(projectionA.value(0)) // undefined

const removeAcknowledgement = projectionB.apply(removeDelta)
console.log(projectionB.value(0)) // undefined

projectionA.apply(removeAcknowledgement?.[1])

const serializable = projectionA.sequence()

const acknowledgements = projectionB.merge(serializable)
projectionA.apply(acknowledgements?.[1])

projectionA.destroy()
projectionB.destroy()

Benchmarks

2026-11-29T19:34:35.469Z · CI run

Moderate bundle size

Format Raw (KiB) Minified (KiB) Minified + gzip (KiB)
ESM 234.05 186.97 65.06
CommonJS 234.27 189.77 65.38

Both bundles include WASM. Terser uses three compression passes; gzip uses level 9.

Average throughput during editing to checkpoint

Arithmetic means of 3 runs, in ops/s, from each phase's start to checkpoint. Strips contain 1–100 Frames (visible entries). Headers show Strip counts and mean Frame counts.

↑ Scale up (0 → 25,000 Strips)

Method / case 1,000 Strips
50,871 Frames
5,000 Strips
252,214 Frames
10,000 Strips
504,871 Frames
15,000 Strips
758,280 Frames
20,000 Strips
1,010,749 Frames
25,000 Strips
1,264,003 Frames
apply.random 452,117 587,312 626,438 643,353 631,797 612,479
insert.head 2,138,030 2,398,548 2,546,452 2,654,770 2,662,413 2,683,810
insert.random 1,278,091 1,318,098 1,340,919 1,362,450 1,276,549 1,284,503
insert.tail 2,381,435 2,700,752 2,874,711 2,801,273 2,873,143 2,821,026
remove.head — — — — — —
remove.random 1,034,648 1,016,755 1,068,662 1,078,130 1,075,341 1,069,608
remove.tail — — — — — —
replace.head 843,063 963,314 1,073,954 1,097,091 1,021,540 1,009,428
replace.random 729,647 731,608 708,391 719,480 718,078 725,346
replace.tail 736,494 928,707 995,869 1,029,751 1,035,847 1,061,025
value.head 4,771,057 7,023,956 7,939,157 8,402,079 8,649,996 8,856,682
value.random 2,749,594 2,223,309 2,131,613 2,046,844 1,961,164 1,920,031
value.tail 8,899,714 12,180,644 13,649,552 14,647,951 15,221,036 15,547,488

↓ Scale down (25,000 → 0 Strips)

Method / case 20,000 Strips
1,012,742 Frames
15,000 Strips
755,860 Frames
10,000 Strips
504,103 Frames
5,000 Strips
251,203 Frames
1,000 Strips
51,057 Frames
0 Strips
0 Frames
apply.random 655,182 654,082 669,418 671,522 686,062 691,721
insert.head — — — — — —
insert.random 1,195,728 1,271,546 1,315,246 1,358,731 1,385,358 1,402,141
insert.tail — — — — — —
remove.head 1,655,637 1,678,866 1,554,728 1,598,915 1,627,513 1,632,247
remove.random 1,006,429 1,083,119 1,116,956 1,160,032 1,191,597 1,204,672
remove.tail 1,836,210 1,845,463 1,854,161 1,866,053 1,864,593 1,868,728
replace.head 1,054,973 958,634 1,001,247 1,013,006 1,030,219 1,033,399
replace.random 764,293 741,028 775,910 786,267 808,040 818,958
replace.tail 878,810 699,332 490,188 567,165 564,873 576,256
value.head 5,302,892 5,331,010 5,313,713 5,380,033 5,469,402 5,528,130
value.random 1,850,431 1,847,961 1,881,589 1,920,661 1,985,598 2,027,190
value.tail 7,917,754 7,879,543 7,821,008 7,923,504 8,173,694 8,270,465

API throughput at checkpoint

Checkpoint calls, in ops/s, averaged across runs.

↑ Scale up (0 → 25,000 Strips)

Method 1,000 Strips
50,871 Frames
5,000 Strips
252,214 Frames
10,000 Strips
504,871 Frames
15,000 Strips
758,280 Frames
20,000 Strips
1,010,749 Frames
25,000 Strips
1,264,003 Frames
new Projection(actorID, sequence) 5,875 2,239 1,015 762 529 465
sequence() 799 183 127 102 65 57
values() 963 340 339 229 160 131

↓ Scale down (25,000 → 0 Strips)

Method 20,000 Strips
1,012,742 Frames
15,000 Strips
755,860 Frames
10,000 Strips
504,103 Frames
5,000 Strips
251,203 Frames
1,000 Strips
51,057 Frames
0 Strips
0 Frames
new Projection(actorID, sequence) 529 722 1,046 2,161 7,992 49,858
sequence() 78 94 125 152 213 92,807
values() 167 230 353 672 2,419 208,983

Sequence disk size at checkpoint

Complete exported Sequences, including Footage and acknowledgements. Sizes are in KiB.

↑ Scale up (0 → 25,000 Strips)

Encoding 1,000 Strips
50,871 Frames
5,000 Strips
252,214 Frames
10,000 Strips
504,871 Frames
15,000 Strips
758,280 Frames
20,000 Strips
1,010,749 Frames
25,000 Strips
1,264,003 Frames
JSON 277.64 1,620.98 3,264.86 4,933.05 7,109.34 9,254.31
JSON + gzip 14.58 73.44 148.96 225.96 310.83 392.21
MessagePack 164.81 818.92 1,646.03 3,553.60 5,126.26 6,551.31
MessagePack + gzip 12.38 61.63 124.79 200.04 263.37 335.03

↓ Scale down (25,000 → 0 Strips)

Encoding 20,000 Strips
1,012,742 Frames
15,000 Strips
755,860 Frames
10,000 Strips
504,103 Frames
5,000 Strips
251,203 Frames
1,000 Strips
51,057 Frames
0 Strips
0 Frames
JSON 7,558.41 5,690.87 3,807.99 1,887.07 381.23 0.02
JSON + gzip 326.34 247.06 164.87 79.62 15.97 0.03
MessagePack 5,312.11 3,982.74 2,657.44 1,319.71 266.79 0.01
MessagePack + gzip 278.24 210.00 140.04 67.75 13.65 0.03

Memory usage at checkpoint

One instance after checkpoint compaction and recreation: live native allocation plus retained JS array slots and string code units, in MiB (1,048,576 bytes). Unused WASM capacity is excluded.

↑ Scale up (0 → 25,000 Strips)

Measurement 1,000 Strips
50,871 Frames
5,000 Strips
252,214 Frames
10,000 Strips
504,871 Frames
15,000 Strips
758,280 Frames
20,000 Strips
1,010,749 Frames
25,000 Strips
1,264,003 Frames
Estimated memory (MiB) 0.62 3.09 6.19 9.43 12.82 16.28

↓ Scale down (25,000 → 0 Strips)

Measurement 20,000 Strips
1,012,742 Frames
15,000 Strips
755,860 Frames
10,000 Strips
504,103 Frames
5,000 Strips
251,203 Frames
1,000 Strips
51,057 Frames
0 Strips
0 Frames
Estimated memory (MiB) 13.34 9.90 7.14 4.08 1.81 1.23

Measured on Node 24.22.3, V8 13.6.233.17-node.63, linux x64, AMD EPYC 9V45 96-Core Processor. Peer synchronization, encoding and explicit JS process garbage collection are outside API timings. Full lifecycle results · Throughput results.

Tuple mode

Usage

Each index represents an independent slot. Adding or removing values never shifts other values. Empty slots return undefined.

Omit maxLength to allow dynamic growth.

const tuple = new Projection<string>(1, undefined, { enabled: 1, maxLength: 4 })
tuple.insert(['hello'], 2)
tuple.replace(['world'], 2, 2)
tuple.remove(2, 2)

Benchmarks

2026-11-29T19:36:03.042Z · CI run

Arithmetic means of 3 runs. Ordinary Projection versus a static tuple with maxLength. Both contain the same values; replacements preserve the field count.

Throughput (ops/s)

Indices Method / case Projection Static tuple Tuple / Projection
2 create.sequence 1,149,210 1,154,966 1.01×
2 batch.insert 5,815,872 2,095,474 0.36×
2 replace.random 2,137,459 2,596,380 1.21×
2 apply.replace 899,817 1,159,687 1.29×
2 value.random 49,643,256 97,035,162 1.95×
4 create.sequence 978,212 1,009,957 1.03×
4 batch.insert 5,972,811 1,599,519 0.27×
4 replace.random 1,724,483 3,041,504 1.76×
4 apply.replace 865,253 1,806,622 2.09×
4 value.random 38,570,899 104,971,099 2.72×
8 create.sequence 674,665 752,709 1.12×
8 batch.insert 6,122,453 1,147,201 0.19×
8 replace.random 1,389,334 2,471,270 1.78×
8 apply.replace 849,078 1,618,427 1.91×
8 value.random 30,652,542 107,290,148 3.50×
100 create.sequence 129,116 142,777 1.11×
100 batch.insert 5,888,930 179,134 0.03×
100 replace.random 1,235,992 2,416,335 1.95×
100 apply.replace 814,933 1,679,229 2.06×
100 value.random 20,018,276 104,397,413 5.22×

Memory and encoded size

Indices Mode Estimated allocated memory (MiB) MessagePack (KiB) MessagePack + gzip (KiB)
2 Projection 0.0006 0.03 0.04
2 Static tuple 0.0007 0.04 0.05
4 Projection 0.0013 0.06 0.05
4 Static tuple 0.0009 0.06 0.07
8 Projection 0.0022 0.12 0.08
8 Static tuple 0.0013 0.10 0.09
100 Projection 0.0196 0.67 0.57
100 Static tuple 0.0110 0.51 0.35

Measured on Node 24.22.3, V8 13.6.233.17-node.63, linux x64, AMD EPYC 9V45 96-Core Processor. Fixtures are hydrated compacted snapshots after one replacement per field. Each case warms up for ≥25 ms and measures ≥50 ms of API time; mutation bursts restart after 4,096 replacements. Batch insertions use 512 fresh instances per burst, constructed outside timing. Peer authoring, encoding, result checks, destruction and explicit JS process garbage collection are outside API timings. Memory estimates are the increase in live native allocator bytes plus retained JS array slots for one instance, including exercised runtime buffers. Unused WASM capacity, JS object headers and referenced payload objects are excluded.

Full tuple results.

Text mode

Usage

String inputs retain UTF-16 code units without creating character arrays. Array results remain the default; true requests string Footage.

const text = new Projection<string>(1)
const gossip = text.insert('Hello', 0)
const replica = new Projection<string>(2)
replica.apply(gossip, true)
const visibleText = replica.values(undefined, undefined, true)
const snapshot = replica.sequence(true)
const restored = new Projection<string>(3, snapshot, undefined, true)
text.destroy()
replica.destroy()
restored.destroy()

Benchmarks

2026-11-29T19:36:46.718Z · CI run

3 runs; median throughput in ops/s. Sizes are UTF-16 code units.

Operation 1,024 array 1,024 string 65,536 array 65,536 string 1,048,576 array 1,048,576 string
insert 1,166,328 3,960,530 4,484 4,443,584 296 3,528,365
insert.append 98,898 550,265 1,334 172,838 55 2,336
replace 678,312 1,142,437 4,372 1,300,417 305 1,066,027
remove 1,691,660 1,784,684 1,220,025 1,819,040 435,638 1,512,092
remove.middle 1,024,237 1,625,305 4,736 1,711,142 313 1,541,065
replace.middle 827,026 1,237,197 4,718 1,265,421 300 1,217,084
apply 1,708,275 1,716,366 1,816,556 1,963,955 1,799,052 1,734,880
apply.array 2,689,433 977,749 2,887,507 4,435 2,621,216 295
concurrent.apply 46,941 555,973 527 8,765 31 631
merge 665,697 1,190,168 4,387 1,181,352 301 1,284,519
create 646,691 1,368,717 4,510 1,183,717 307 1,332,422
value.random 33,747,557 27,690,737 33,804,497 27,879,586 29,812,243 28,795,660
values.range 17,096,160 14,160,467 16,157,432 14,653,183 17,371,507 14,821,343
values.array 3,193,990 1,673,414 4,784 4,524 338 304
values.text 222,673 29,824,562 2,472 31,245,858 152 26,789,758
sequence.array 2,064,896 1,382,873 4,776 4,593 337 299
sequence.text 266,689 12,693,762 4,311 12,423,513 47 11,969,495
sequence.edited.text 282,614 6,125,567 4,604 5,624,832 44 6,590,216
sequence.masked.text 210,487 627,756 4,588 606,139 49 650,746

Encoded snapshots use string Footage in both representations.

Memory and encoded size

UTF-16 code units Representation Estimated MiB Snapshot MessagePack KiB Snapshot gzip KiB Gossip MessagePack KiB Gossip gzip KiB
1024 array 0.0082 1.02 0.05 2.02 0.05
1024 string 0.0023 1.02 0.05 1.02 0.05
65536 array 0.5004 64.02 0.12 128.02 0.18
65536 string 0.1254 64.02 0.12 64.02 0.12
1048576 array 8.0004 1024.02 1.05 2048.02 2.05
1048576 string 2.0004 1024.02 1.05 1024.02 1.05

Measured on Node 24.22.3, V8 13.6.233.17-node.63, linux x64, AMD EPYC 9V45 96-Core Processor. Splitting and text assembly are included where required; peer preparation, encoding and explicit JS process garbage collection are outside API timings.

Full text results.

Packed words

Usage

Unpacked words remain the default. The optional final binaryEncode argument returns Uint8Array metadata for binary serializers such as MessagePack. Footage keeps its existing array or string representation.

const projection = new Projection<string>(1)
const gossip = projection.insert('Hello', 0, true)
const snapshot = projection.sequence(true, true)
const replica = new Projection<string>(2, snapshot, undefined, true)
replica.apply(projection.remove(0, 0, true), true, true)
projection.destroy()
replica.destroy()

Benchmarks

2026-11-29T19:39:12.801Z · CI run

3 runs, 6,000 edits. Median results; string Footage in both modes.

Workload Words Snapshot KiB Snapshot gzip KiB Mean update B Encode ops/s Load ops/s Receive batches/s
append unpacked 5.90 3.61 22.88 94,763 342,237 712
append packed 5.90 3.61 13.98 88,170 361,397 763
prepend unpacked 40.07 18.07 22.94 5,268 1,754 551
prepend packed 5.90 3.62 13.99 85,109 3,214 591
random unpacked 138.05 57.31 39.88 1,216 431 192
random packed 49.58 35.37 23.45 52,458 992 255
concurrent unpacked 92.22 42.76 32.34 1,681 486 246
concurrent packed 38.94 28.22 20.71 52,510 1,134 297

Measured on Node 24.22.3, V8 13.6.233.17-node.63, linux x64, AMD EPYC 9V45 96-Core Processor. Random and concurrent workloads mix insertion, removal and replacement. Concurrent authors edit independent views. Sizes use MessagePack; updates are encoded individually. Load includes decoding and construction. Receive includes decoding and applying one complete edit batch. Preparation, checks, destruction and explicit JS process garbage collection are outside timings.

Full words results.

Batch

Collect local edits into one packed Gossip. Edits are immediately visible; Footage stays in JavaScript.

Usage

const projection = new Projection<string>(1)
const peer = new Projection<string>(2)
projection.apply([[1], [2]])
peer.apply([[1], [2]])
const gossip = projection.batch((edit) => {
  edit.insert('hello', 0)
  edit.replace('H', 0, 0)
})
const result = peer.apply(gossip, true, true)
projection.apply(result?.[1] ?? [])
projection.destroy()
peer.destroy()

Benchmarks

2026-11-29T19:39:30.082Z · CI run

3 runs, 6,000 edits per author. Concurrent authors edit independent views; causal authors exchange history before the second author edits. Median results.

Workload Mode Author edits/s Apply edits/s Receive edits/s Update/author KiB Document KiB Memory MiB
append individual 5,116,690 8,021,058 3,069,343 76.05 5.99 0.012
append batch 3,234,039 503,018,109 548,145,441 5.88 5.99 0.012
prepend individual 3,789,163 5,257,651 2,142,816 76.11 5.99 0.896
prepend batch 3,216,091 6,398,239 5,875,418 5.89 5.99 0.896
random.characters individual 2,128,375 2,410,690 1,802,104 82.09 28.31 0.917
random.characters batch 1,999,128 3,681,474 3,525,362 22.95 28.31 0.917
random.words individual 1,995,260 2,769,936 1,715,244 125.68 73.88 0.991
random.words batch 2,031,243 3,258,316 3,099,707 59.71 73.88 0.991
concurrent.characters individual 2,360,668 2,601,183 1,746,498 82.04 56.41 1.834
concurrent.characters batch 2,342,320 3,398,822 2,961,130 22.92 56.41 1.834
concurrent.words individual 2,332,376 2,618,264 1,549,533 125.74 147.81 1.981
concurrent.words batch 2,245,580 3,065,809 2,655,056 59.79 147.81 1.981
concurrent.mixed individual 1,402,395 1,744,324 1,279,279 154.61 97.82 1.505
concurrent.mixed batch 1,512,095 2,231,773 2,043,683 56.87 97.82 1.505
causal.characters individual 2,094,318 2,750,772 1,898,197 88.96 63.81 1.842
causal.characters batch 1,948,624 3,329,249 2,900,841 23.18 63.81 1.842
causal.words individual 2,095,485 2,459,600 1,591,556 135.13 156.41 1.989
causal.words batch 1,845,062 3,056,760 2,614,647 60.68 156.41 1.989
causal.mixed individual 1,372,775 1,719,796 1,204,536 161.05 103.75 1.509
causal.mixed batch 1,595,744 2,185,954 2,004,800 57.34 103.75 1.509

Measured on Node 24.22.3, V8 13.6.233.17-node.63, linux x64, AMD EPYC 9V45 96-Core Processor. Both modes group each author's binary Gossip into one MessagePack message. Batch Footage is uncompressed. Receive includes MessagePack decoding; apply excludes it. Document size follows complete acknowledgement exchange. Memory estimates use one receiver recreated from that compact checkpoint in a fresh runtime, excluding the author runtime. Preparation, verification, destruction and explicit JS process garbage collection are outside timings.

Full batch results.

Attachments

Usage

const text = new Projection<string, { bold: boolean }>(
  1,
  undefined,
  undefined,
  true,
  { enabled: true, inherited: true }
)

const insertion = text.insert('Hello', 0, true, { bold: true })
text.insert('!', text.length()) // inherits bold
const replacement = text.replace('h', 0, 0, true, { bold: false })
console.log(text.attachments()) // [start, exclusiveEnd, attachment] ranges
console.log(text.value(1, true)) // ['e', { bold: true }]
for (const [content, attachment] of text.values(0, 4, true, true)) {
  console.log(content, attachment)
}

const snapshot = text.sequence(true, true)
const restored = new Projection<string, { bold: boolean }>(
  2,
  snapshot,
  undefined,
  true
)

text.destroy()
restored.destroy()

Attachments belong to their inserted Footage and follow its fragments through deletion and compaction. Replacements supply the new Footage's attachment. inherited uses the preceding Frame when a local insertion or replacement omits an explicit value; at index 0 it uses the current first Frame instead. Different attachments keep consecutive Insertions separate.

Splices have exactly these forms:

[start, end]
[start, end, footage]
[start, end, footage, attachment]

Missing attachments omit the field. The conditional [] in the TypeScript tuple declaration means no additional field, not an empty attachment payload.

value(at, true) returns [value, attachment?]. The fourth values() argument returns consecutive [values, attachment?] segments in one read, without indices. Each segment contains an array, or text when stringEncode is true. Both methods keep their ordinary return values without the flag; absent attachments omit the field.

Gossip carries an optional attachment directly. Packed batches and snapshots use one flat attachment array with its positions in the words. The array is omitted when empty. Snapshot hydration restores attachment mode and inheritance; explicit constructor options override inheritance. Ordinary Projections retain their existing two-field snapshots.

Benchmarks

2026-11-29T19:39:36.055Z · CI run

3 runs; median throughput in ops/s. One attachment value per range, not per Frame.

Frames Operation disabled enabled single.range ranges
100 insert 1,657,276 1,566,995 1,545,952 1,391,819
100 replace 752,464 737,142 669,650 674,021
100 remove 1,084,768 1,031,822 1,052,884 1,047,122
100 apply 763,522 888,741 953,744 775,361
100 sequence 1,933,322 974,682 1,345,483 905,182
100 create 1,099,779 605,420 585,953 493,910
100 create.empty 2,899,474 868,189 910,937 850,387
100 attachments 8,045,800 5,359,899 3,475,528 3,003,154
100 value.attached 6,563,224 5,447,493 3,448,362 4,437,715
100 values.attached 2,591,021 2,933,291 868,528 840,792
100 values.attached.text 5,085,381 2,977,335 5,556,999 3,152,390
6000 insert 1,515,553 1,504,836 1,420,639 774,358
6000 replace 638,664 760,871 686,732 451,989
6000 remove 1,041,968 1,063,858 1,009,047 775,494
6000 apply 1,193,710 728,526 773,789 554,024
6000 sequence 2,214,538 1,368,981 1,041,677 94,115
6000 create 1,033,171 554,534 493,723 81,050
6000 create.empty 2,615,809 909,382 819,439 827,749
6000 attachments 8,744,672 5,806,260 3,924,733 276,795
6000 value.attached 4,412,868 3,643,856 3,295,298 3,890,201
6000 values.attached 169,698 169,394 21,173 24,565
6000 values.attached.text 3,287,851 2,769,994 2,628,552 155,647
Frames Mode Estimated MiB Snapshot KiB Snapshot gzip KiB Update bytes
100 disabled 0.0006 0.11 0.04 13
100 enabled 0.0006 0.12 0.04 13
100 single.range 0.0007 0.12 0.04 13
100 ranges 0.0010 0.13 0.06 14
6000 disabled 0.0119 5.88 0.07 14
6000 enabled 0.0119 5.88 0.07 14
6000 single.range 0.0119 5.88 0.07 14
6000 ranges 0.0242 6.08 0.09 15

Measured on Node 24.22.3, V8 13.6.233.17-node.63, linux x64, AMD EPYC 9V45 96-Core Processor. Payloads, transport encoding and explicit JS process garbage collection are outside API timings. Memory estimates cover one instance’s native allocation and JS binding slots, excluding application-owned attachment payloads.

Full attachment results.

Validation

Supply application predicates in the sixth constructor argument:

const text = new Projection<string, { bold: boolean }>(
  1,
  undefined,
  undefined,
  true,
  { enabled: true },
  {
    footage: (value) => typeof value === 'string',
    attachment: (value) => typeof value?.bold === 'boolean',
  }
)

Tuple predicates also receive the stable index: (value, index) => boolean. Local rejection throws FOOTAGE_VALIDATION_FAILED or ATTACHMENT_VALIDATION_FAILED before changing the edit. External rejection skips the complete Insertion, packed batch or merged Sequence; other Gossip entries can still apply. Throwing external predicates also reject the input. Trusted constructor Sequences and undefined values are not checked. Omitting predicates keeps validation disabled.

Errors

Code Meaning
PROJECTION_DESTROYED An operation was called after the Projection was destroyed.
BATCH_CLOSED An editor was used after its batch callback finished.
NATIVE_OPERATION_FAILED The native runtime reported an initialization or operation failure.
STRING_ENCODING_FAILED Footage concatenation as text failed.
INVALID_ATTACHMENTS Snapshot attachment metadata is invalid or explicitly disabled.
FOOTAGE_VALIDATION_FAILED A local Footage value was rejected by its application predicate.
ATTACHMENT_VALIDATION_FAILED A local attachment was rejected by its application predicate.
UNKNOWN_ERROR All other errors.

Malformed transport data passed to apply() or merge() may return undefined instead of throwing.

Tests

Behaviour guaranteed by excessive tests

2026-11-29T19:34:23.913Z · CI run

The latest verification passed 494 Vitest tests and 171 compatibility checks. The configured 100% coverage threshold is met (100% statements, 100% branches, 100% functions, 100% lines). See the test suites and automated test report.

Works everywhere where JavaScript and Wasm works

2026-11-29T19:34:23.918Z · CI run

Runtimes covered by the latest compatibility verification:

  • Node.js, ESM: passed
  • Node.js, CommonJS: passed
  • Deno: passed
  • Bun: passed
  • Edge Runtime: passed
  • Cloudflare Workers through workerd: passed
  • Chromium browser windows: passed
  • Firefox browser windows: passed
  • WebKit browser windows: passed

Tested realtime and offline text editing behaviour examples

  • Online and offline editors: six editors converge through delayed, reversed and shuffled delivery, including offline changes arriving during online editing.
  • Concurrent replacements: independent replacement histories retain the same surviving content across delivery orders.
  • Restart and redelivery: stored Sequences preserve visible content through hydration, duplicate delivery and further edits.
  • Peer-to-peer fanout: independently editing browser peers synchronize through BroadcastChannel.
  • WebSocket fanout: three browser peers converge through a stateless JSON Gossip relay.

Credits

This could not have been made without years of work from many great engineers of many great projects, to mention a few:

License

Licensed under the Apache License, Version 2.0.

Copyright © 2026 Sovereignbase.

About

A causality-encoding engine written in TypeScript and C++ to build high-performance, conflict-free replicated data types for the web.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages