Symbols
functional reactive programming (FRP) 285
@@iterator method 322
@@name convention
reference link 322
ZMQ 340
A
adaptee 295
Adapter pattern 294
LevelUP, using through filesystem API 295, 296, 298
real-world examples 298
addCps() function 65
Advanced Message Queuing Protocol (AMQP) 548
reference link 548
Amazon Kinesis
reference link 573
AMQP 564
chat application, integrating with 569, 570
competing consumers 588
durable subscribers 566
history service, implementing 567, 568
pipelines 588
point-to-point communications 588
return address pattern, implementing 605, 606
AMQP, components
binding 565
exchange 565
queue 564
AMQP model
reference link 565
Ansible
URL 501
ANSI escape sequences
reference link 372
Apache Kafka
reference link 573
API orchestration
URL 532
API server
without, asynchronous request batching 439, 440, 441
without, asynchronous request caching 439, 440, 441
application scaling 476
archiver
using, reference link 197
async/await 141
limited parallel execution pattern 149, 150, 151, 152
sequential execution 145, 146, 147
sequential iteration 145, 146, 147
used, for error handling 143
using, with Array.forEach for serial execution 147
async generator function
defining 334
async generator objects 334
asynchronicity
with deferred execution 72, 73
asynchronous CPS
versus synchronous CPS 67
asynchronous invocations
cancelable async functions, with generators 449, 451, 452, 453
asynchronously initialized components
code execution, delaying 430
dealing with 428
local initialization check 429
Mongoose 435
pre-initialization queues 431, 432, 433, 435
asynchronous messaging 546
asynchronous module definition (AMD) 19
asynchronous operations
cancelable functions, creating 446, 447
canceling 445
asynchronous programming 63
issues 90
asynchronous request batching 435, 436, 437
in total sales web server 442, 443
with promises 441
asynchronous request caching 435
implementation 445
in total sales web server 443, 444
with promises 441
async imports
async iterators 178, 331, 332, 333, 334, 336
autocannon
URL 483
awilix
reference link 265
B
Babel
reference link 363
batch operations
URL 293
behavioral design patterns
Command pattern 347
Iterator pattern 319
Middleware pattern 337
State pattern 308
Strategy pattern 302
Template pattern 315
binary buffer 558
bound function 349
Brotli
using 195
browser
browserify
reference link 362
Browserify
URL 19
Brunch
reference link 362
buffered API
using, for Gzipping 162
buffering
Builder pattern 241, 242, 244, 248
URL object builder, implementing 244, 246, 247
build-time code branching 374, 375, 376
built-in Proxy object 277, 278
capabilities and limitations 278, 279
C
callback
best practices 94
callback discipline 95
callback pattern 64
continuation-passing style (CPS) 64
callbacks 63
chain-of-responsibility pattern 338
reference link 338
chalk
reference link 377
Change Observer pattern
creating, with Proxy pattern 282, 283, 284, 285
chat application
history service, designing for 566, 567
implementing, with Redis Streams 573, 575, 576, 577
integrating, with AMQP 569, 570
chat server
peer-to-peer architecture, designing for 558
child process
child processes 460
circular dependencies 29, 30, 32
circular dependency resolution, ECMAScript modules (ESM)
evaluation phase 54
cloning 479
closures 64
URL 64
cloud-based proxies 496
cluster module
about 480
edge cases 482
resiliency, and availability with 486, 487, 488
used, for building HTTP server 482, 484
zero-downtime restart 488, 489, 490
code
sharing, with browser 358, 359
code minification 360
combined streams
Command Message 544
Command pattern 347
client 348
command 348
complex command 349, 350, 351, 352, 353
invoker 348
target 348
Task pattern 349
CommonJS
URL 19
CommonJS modules
about 22
circular dependencies 29, 30, 32
defining 24
homemade module loader 22, 23, 24
module cache 28
module.exports, versus exports 25
require function is synchronous 26
versus ESM 60
CommonJS modules, concepts
exports and module.exports variables 22
require function 22
competitive race 108
complex applications
decomposing 523
component 379
concurrency
limiting 112
limiting, globally 113
concurrent tasks
race conditions, fixing 108, 109, 110
conditional rendering 388
constructor injection 265
Consul
URL 504
used, for implementing dynamic load balancer 503, 504, 505, 506, 507, 508, 509
consumer groups 593
container image 515
containers
about 513
creating, with Docker 514, 515, 516, 517
running, with Docker 514, 515, 516, 517
used, for scaling applications 513
content delivery network (CDN) 370
context 302
continuation-passing style (CPS) 64
non-CPS callbacks 67
synchronous CPS 65
control flow patterns 94
core-js
URL 280
Correlation Identifier 598
CouchDB
URL 491
CPU-bound tasks
executing 453
executing, in production 472
external processes, using 460
interleaving approach, interleaving 459
interleaving, with setImmediate 457
subset sum algorithm, interleaving 457, 458
subset sum problem, solving 453, 454, 455, 456, 457
cross-origin resource sharing (CORS)
reference link 406
cross-platform context
cross-platform development
build-time code branching 374, 375, 376
design patterns 378
fundamentals 371
runtime code branching 372
csv-parse module
URL 190
D
databases
reference link 337
data ownership 527
implementation techniques 286
used, for decorating LevelUP database 290
versus Proxy pattern 294
Decorator pattern implementation techniques 286
object augmentation (decoration) 288, 289
delegates
URL 275
demultiplexing 223
denial-of-service (DoS) 461
denial-of-service (DoS) attack 111
dependency hoisting 256
dependency injection container 265
Dependency Injection (DI) 261, 262, 263, 264
design patterns, cross-platform development
adapter 378
dependency injection 379
proxy 378
service locator 379
strategy 378
template 378
developer experience (DX) 435
directed graph
URL 48
direct style 65
distributed hashsum cracker, building with ZeroMQ 580, 581
application, running 587
producer, implementing 582, 583, 584
result collector, implementing 586
Docker
URL 514
used, for creating container 514, 515, 516, 517
used, for running container 514, 515, 516, 517
Dockerfile 515
Document Message 545
Don't Repeat Yourself (DRY) 3
duck typing 128
reference link 239
duplexer2
URL 215
duplexify
URL 215
Duplex streams
about 185
durable subscriber 562
durable subscribers
with AMQP, and RabbitMQ 566
dynamic horizontal scaling
about 501
dynamic load balancer, implementing with Consul 503, 504, 505, 506, 507, 508, 509
dynamic load balancer, implementing with http-proxy 503, 504, 505, 506, 507, 508, 509
service registry, using 501, 502, 503
dynamic load balancer
implementing, with Consul 503, 504, 505, 506, 507, 508, 509
implementing, with http-proxy 503, 504, 505, 506, 507, 508, 509
dynamic scaling 501
E
early return principle 96
ECMAScript modules (ESM)
circular dependency resolution 50, 51
default exports and imports 42, 43
loading 48
module identifiers 45
named exports and imports 39, 41, 42
read-only live bindings 49, 50
running, in strict mode 60
using, in Node.js 39
versus CommonJS modules 60
Elasticsearch
URL 529
entry point 48
ErrorBoundary component
reference link 388
error handling, async/await
return, versus return await 144, 145
esx
reference link 384
EventEmitter
event loop 9
Event Message 545
event notification interface 7
Express
Middleware pattern 337
external process
subset sum task, delegating to 461
F
Factory pattern 234
code profiler, building 238, 239, 240
encapsulation mechanism 236
object creation and implementation, decoupling 235
fail fast approach 77
fastify 293
URL 293
Fastify
reference link 391
fastify-cors
reference link 406
first in first out (FIFO) 445
flow control 203
flowing mode 173
function injection 265
FuseBox
reference link 362
G
garbage collection, JavaScript
URL 83
generator delegation 331
generator function
defining 327
generator iterator
generator object 327
using, instead of iterators 330, 331
get trap 279
global scope
glob package
URL 87
God object 536
Gzipping
with buffered API 162
with streams 163
H
HAProxy
about 496
URL 496
hashsum cracker implementation, with AMQP 588
about 589
application, running 592
producer, implementing 589, 590
result collector, implementing 591
hashsum cracker implementation, with Redis Streams 594
producer, implementing 594
worker, implementing 595, 596, 597, 598
has trap 279
high coupling 526
history service
designing, for chat application 566, 567
implementing, with AMQP 567, 568
homemade module loader 22, 23, 24
horizontal scaling 480
horizontal/vertical partitioning 479
htm
reference link 384
HTTP/2 Server Push
reference link 360
http-proxy
used, for implementing dynamic load balancer 503, 504, 505, 506, 507, 508, 509
HTTP server
hydration
reference link 380
I
Immediately Invoked Function Expression (IIFE) 21, 368
inconsistently asynchronous function 68
inconsistentRead() function
infinite recursive promise resolution chains
infrastructure as code 501
injector 261
intercepting filter pattern 338
reference link 338
inversify
reference link 265
Inversion of Control 265
I/O completion port (IOCP) 11
I/O starvation 73
iterables 322
as native JavaScript interface 324, 325, 326
Iterator pattern 319
async generators 334
async iterators 331
generators 327
iterator protocol 319, 320, 321
iterator protocol 319, 320, 321, 322
iterator result 319
iterators 178
as native JavaScript interface 324, 325, 326
reference link 321
J
JavaScript, in Node.js
about 13
accessing, operating system services 14
module system 14
JavaScript modules
in cross-platform context 359, 360
Jest
URL 59
json-socket module
URL 293
JSX
reference link 383
JugglingDB 299
URL 299
K
Keep It Simple, Stupid (KISS) 4
KISS principle (Keep It Simple, Stupid) 90
Knex
reference link 241
Koa
reference link 347
kubectl
URL 519
Kubernetes
application, deploying and scaling on 519, 520
rollouts 523
URL 518
Kubernetes deployment
L
lazy initialization 280
lazy streams
reference link 198
least recently used (LRU) 445
LevelDB 290
level-filesystem
URL 299
LevelGraph
URL 290
level package
URL 291
LevelUP 290
ecosystem, URL 290
URL 290
using, through filesystem API 295, 296, 298
LevelUP database
decorating, with Decorator pattern 290
LevelUP plugin
LevelUP plugins
level-inverted-index, URL 293
levelplus , URL 293
libuv
about 11
URL 12
links
Linux container
= 513
load balancer, implementing with reverse proxy
options 496
load balancing
about 479
with Nginx 496, 497, 498, 499, 500, 501
load distribution 477
loading phases, ECMAScript modules (ESM)
construction phase 48
evaluation phase 49
instantiation phase 49
lodash
URL 45
logging Writable stream
creating, in Proxy pattern 281, 282
long-term support (LTS) 14
LoopBack 285
URL 285
M
Memcached
URL 491
memory leaks
observer pattern 82
message 544
Command Message 544
Document Message 545
Event Message 545
message broker 547
integrating with 536, 537, 538
message queue 546
message queue (MQ) 562
message queues
versus streams 573
Message Queue Telemetry Transport (MQTT) 548
reference link 548
messaging system
fundamentals 542
Microbundle
reference link 362
microservice architecture
about 526
advantages 528
disadvantages 528
integration patterns 530
microservice architecture, advantages and disadvantages
across platforms and languages, reusability 529
application, scaling 529
challenges 530
service, expendable 529
microservice architecture, factors
high cohesion 526
integration complexity 526
loose coupling 526
microservice architecture, integration patterns
API orchestration 532, 533, 534, 536
integrating, with message broker 536, 537, 538
microtasks 73
middleware framework
creating, for ØMQ 340
middleware framework, for ØMQ
creating 340
middleware functions, creating to process messages 342, 343
Middleware Manager 340, 341, 342
Middleware pattern 337
implementing 339
in Express 337
Middleware Manager 339
using 338
Middy
reference link 347
minikube
URL 519
mkdirp 90
MobX 285
URL 285
mocku module
URL 59
module bundler 360
dependency resolution 363, 364, 365, 366
working 363
module cache 28
module definition patterns
about 33
class, exporting 35
function, exporting 34
instance, exporting 36
named exports 33
module identifiers 45
module objects
reference link 59
module systems
about 20
need for 18
MongoDB 435
MongoDB
URL 491
monolithic application 478
monolithic architecture 524, 525
monolithic kernels 524
multi-pass rendering 413
multiplexing 223
multi-process approach
considerations 467
mux/demux application
running 228
N
namespace import 41
nanoSQL 299
URL 299
Next.js framework
reference link 416
Nginx
load balancing with 496, 497, 498, 499, 500
Nginx
about 496
URL 496
nock
URL 38
Node.js
callback conventions 73
core 2
ECMAScript modules (ESM), using 39
I/O, disadvantages 5
I/O engine, libuv of 11
modules, advantages 3
philosophy 2
philosophy, reference link 2
recipe for 12
simplicity and pragmatism 4
surface area 3
working 5
Node.js applications
scaling 477
scaling, with containers 513
Node.js-based proxies 496
Node.js callback conventions 73, 74, 75, 76, 77
uncaught exceptions 75, 76, 77
Node.js release cycles
reference link 14
nunjucks
reference link 370
O
Object.defineProperty() method
URL 280
object streams
demultiplexing 229
multiplexing 229
observer pattern 77
errors, propagating 80
EventEmitter 78
EventEmitter, and memory leaks 82, 83
EventEmitter, methods 78
observable object, creating 80, 81, 82
ØMQ
middleware framework, creating 340
reference link 340
ØMQ middleware framework
client-side, creating 345, 346
reference link 344
server-side, creating 344, 345
using 344
one way pattern
versus request/reply patterns 542, 543
Open Container Initiative (OCI)
about 513
URL 513
operational transformation (OT) 348
reference link 349
optimal asynchronous request caching
phases 438
ORY
URL 529
P
Packer
URL 501
packet switching 224
limited parallel execution 110, 111
pattern 108
parallel pipeline 579
parallel-transform
URL 212
parcel
reference link 362
Passport 308
reference link 308
supported authentication providers 308
PassThrough streams
about 193
peer-to-peer architecture
designing, for chat server 558
peer-to-peer communication 548
peer-to-peer load balancing
HTTP client, implementing that can balance requests across multiple servers 511, 512, 513
Peer-to-Peer Publish/Subscribe
with ZeroMQ 557
pipeline
processing 338
pipeline()
used, for error handling 201, 202
pipes
used, for connecting streams 198, 199
polyfill 280
PostgreSQL
URL 491
PouchDB
URL 290
private class fields
reference link 237
private variables
reference link 237
process identifier (PID) 483
process pool module
promise 125
creating 130
limited parallel execution 137
parallel execution flow 136, 137
sequential execution 133, 134, 135, 136
sequential iteration 133, 134, 135, 136
used, for implementing TaskQueue class 138, 139
Promises/A 127
Promises/A+ 128
about 124
URL 128
property injection 265
proxy 269
implementing, techniques 271
logging Writable stream, creating 281, 282
used, for creating Change Observer pattern 282, 283, 285
uses, example 270
using, in projects 285
versus Decorator pattern 294
Proxy pattern implementation techniques 271, 272
built-in Proxy object 277, 278
object composition 272, 273, 274, 275
Publish/Subscribe pattern 549
real-time chat application, building 550
pumpify
URL 216
pyramid of doom 93
Q
R
RabbitMQ
durable subscribers 566
reference link 548
race conditions
fixing, with concurrent tasks 108, 109, 110
reachability
URL 83
reference link 391
stateful components 385, 387, 388, 389, 390
react.createElement
React Hardware
reference link 380
reactive programming (RP) 285
React Native
reference link 380
reactor pattern
using 10
React PIXI
reference link 380
React Router
reference link 391
react-three-fiber
reference link 380
Readable streams
about 171
approaches 171
async iterators 174
flowing mode 173
implementing 174, 175, 176, 177
simplified construction 177
real-time chat application
building 550
client side, implementing 551, 552
running 553
scaling 553
server side, implementing 550, 551
records 571
Redis
reference link 554
URL 491
using, as message broker 554, 555, 556
Redis consumer groups 593
Redis Streams
chat application, implementing 573, 575, 576, 577
tasks, distributing 592
reliable message delivery
reliable messaging
with streams 571
remote procedure call (RPC) 348, 544
request/reply abstraction, implementing with correlation identifiers 599, 600
reply, abstracting 602
request/reply cycle
request/reply patterns 598
versus one way pattern 542, 543
require function is synchronous 26
requirejs
URL 19
resiliency 486
resolving algorithm
URL 27
resolving algorithm, branches
core modules 27
file modules 27
package modules 27
return address 605
return address pattern, AMQP
implementing 605
replier, implementing 609, 610, 611
reply abstraction, implementing 608, 609
request abstraction, implementing 606, 607
requestor, implementing 609, 610, 611
Revealing Constructor pattern 249, 250, 253
immutable buffer, building 250, 251, 252
revealing module pattern 20, 21, 22
reverse proxy
rollup
reference link 362
runtime code branching 372
S
scalability
scalability, three dimensions
X-axis 478
Z-axis 479
scaling
with cluster module 484, 485, 486
with reverse proxy 494, 495, 496
semicoroutines 326
sequential crawling
sequential execution flow 98
sequential iteration 100
pattern 103
service-level agreement (SLA) 488
service locator 265
service locator pattern
reference link 368
service registry
set of tasks
executing, in sequence 99
Simple/Streaming Text Orientated Messaging Protocol (STOMP) 548
reference link 548
single-page applications (SPAs) 380
single-responsibility principle (SRP) 35
Singleton dependencies 258, 259, 260, 261
Singleton pattern 253, 254, 255, 256, 257
Socket.IO
URL 494
SQLite 258
sqlite3
reference link 258
stateful communications
state across multiple instances, sharing 491, 492
sticky load balancing 492, 493, 494
used, for implementing failsafe socket 310, 311, 312, 313, 314
state transition 310
sticky load balancing
URL 494
Store front-end 536
strategies 302
Strategy pattern 302, 303, 304
approaches 307
multi-format configuration objects example 304, 305, 306, 307
Passport 308
stream 571
streaming
streaming platform
asynchronous control flow patterns with 203
composability 167
connecting, with pipes 198, 199
data, handling in sequence 203, 205
demultiplexing 223
error handling, with pipeline() 201, 202
for reliable messaging 571
importance, discovering 160
merging 221
multiple checksum generator, implementing 220
multiplexing 223
mux/demux application, running 228
ordered parallel execution 212, 213
pipes and error handling 200
piping patterns 214
remote logger, building 224
time efficiency 163, 164, 165, 166, 167
unordered limited parallel execution 210, 211, 212
used, for Gzipping 163
used, for implementing unordered parallel tasks 206
versus message queues 573
working with 170
streams, composability
client-side encryption, adding 167, 168
server-side decryption, adding 169, 170
streams, demultiplexing
streams, multiplexing
streams, operating modes
binary mode 170
object mode 170
structural design patterns
Adapter pattern 294
Decorator pattern 285
Proxy pattern 269
stubs 317
subset sum problem 453
subset sum task
delegating, to external process 461
executing, in worker threads 469, 471, 472
substack pattern
URL 34
superagent 90
surrogate 269
symbols
reference link 237
synchronous APIs
synchronous CPS
versus asynchronous CPS 67
T
task distribution patterns 577, 578, 579
Task pattern 349
TaskQueue class
implementing, with promise 138, 139
tasks
distributing, with Redis Streams 592
template methods 315
configuration manager template 316, 317, 318
purpose 315
ternary-stream package
URL 229
Terraform
URL 501
Terser
reference link 376
transform streams
data, aggregating with 189, 190, 191, 192
data, filtering with 189, 190, 191, 192
Transform streams
simplified construction 188, 189
transpilation (transcompilation) 280
trap methods 277
URLs 279
tree shaking
reference link 366
U
Universal data retrieval 411
async pages implementation 416, 418, 420, 422, 423, 424
Universal JavaScript app
asynchronous data retrieval 405, 406, 407, 409, 411
creating 391
frontend only-app 392, 393, 394, 395, 397, 398, 399
server-side rendering 399, 400, 401, 402, 403, 404
Universal Module Definition (UMD)
URL 19
unordered parallel stream
URL status monitoring application
userland 2
V
variable 302
vertical scaling 480
virtual DOM
reference link 379
virtual machines
= 514
Vue.js
version 3 285
version 3, URL 285
W
WeakMaps
reference link 237
WebAssembly
reference link 16
webpack
reference link 362
URL 19
webpack, alternatives
browserify 362
parcel 362
rollup 362
web spider
web spider version 2 100
web spider version 4 116, 117, 118, 119
wiring modules 257
worker module
implementing 466
worker threads
about 468
subset sum task, executing 469, 471, 472
using 468
Writable streams
about 179
simplified construction 184
Z
Zalgo 70
zero-downtime restart 488, 489, 490
distributed hashsum cracker, building 580, 581
URL 511
ZeroMQ Fanout/Fanin pattern 579
PUSH/PULL sockets 580
zeromq package
reference link 337
ZeroMQ PUB/SUB sockets