npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cocreate/server

v1.11.0

Published

A secure, stateless, clustered headless server built for high-performance multi-tenancy, real-time collaboration, and sandboxed AST execution.

Readme

CoCreate Server

A secure, stateless, clustered headless server built for high-performance multi-tenancy, real-time collaboration, dynamic process orchestration, and distributed mesh execution. This module serves as the primary orchestrator of the CoCreate ecosystem.


Documentation

For a complete guide, deployment examples, and API reference, visit the CoCreate Server Documentation.

Table of Contents


Architectural Overview & Core Design

@cocreate/server is engineered to run stateless, highly available workloads across multi-core systems and distributed cloud infrastructure.

Clustered IPC Architecture

The server operates a single Primary process that forks and manages worker processes across CPU cores.

The Primary process is responsible for:

  • Cluster orchestration
  • Worker lifecycle management
  • Fallback HTTP/HTTPS listeners
  • Inter-process communication (IPC)

Each Worker runs an identical application stack handling:

  • HTTP requests
  • WebSocket connections
  • API routing
  • Database operations
  • Static asset delivery

$$ \text{Primary Process} \xrightarrow{\text{Native IPC}} \begin{cases} \text{Worker 1}\ \text{Worker 2}\ \vdots\ \text{Worker N} \end{cases} $$

Zero Dependency Core

The server minimizes startup time, memory usage, and supply-chain risk by maintaining a lightweight dependency footprint while composing functionality through CoCreate modules.

Automatic Fallback & Cordoning

When every worker enters draining or cordoned mode, the Primary process automatically serves HTTP 307 Temporary Redirect responses so incoming requests can immediately reconnect through external load balancers without downtime.


Core Server Modules

| Module | Purpose | | --- | --- | | index.js | Primary server orchestrator | | ipc.js | Inter-process communication engine | | storage.js | Cluster-wide reactive storage | | getInfrastructure.js | Infrastructure detection | | getIp.js | Public and private IP resolution |


Component Mesh Architecture

The server composes multiple standalone CoCreate modules into a unified runtime.

| Module | Responsibility | | --- | --- | | @cocreate/certificates | TLS certificate management | | @cocreate/socket-server | WebSocket server | | @cocreate/server-mesh | Cluster communication | | @cocreate/crud-server | Database routing | | @cocreate/server-autoscaler | Automatic scaling | | @cocreate/server-telemetry | Monitoring and metrics | | @cocreate/api | Dynamic API execution | | @cocreate/file-server | Static file serving | | @cocreate/lazy-loader | Lazy loading and webhooks |


Programmatic API Reference

Every server instance extends Node.js EventEmitter.

Instance Properties

| Property | Description | | --- | --- | | id | Unique server identifier | | isPrimary | Indicates Primary process | | workerId | Worker identifier | | totalWorkers | Number of workers | | state | Current server state | | storage / store | Reactive cluster storage | | send() | IPC message dispatcher |

Status Events

server.on("status_change", ({ oldStatus, newStatus }) => {
	console.log(`State changed from ${oldStatus} to ${newStatus}`);
});

Ingress & Connection Controls

server.cordon(value)

Enable or disable maintenance mode.

server.cordon(true);

server.emit("cordon", {
	value: true
});

server.cordon(false);

server.shed(organizations)

Drain selected organizations.

server.shed([
	"org_abc123",
	"org_xyz789"
]);

server.shed(false);

server.drain(value)

Gracefully disconnect active clients.

server.drain(true);

server.drain(false);

Process & OS Lifecycle Management

Restart

server.restart();

server.restart({
	isPrimary: true
});

Worker restart:

  • Drains connections
  • Exits gracefully
  • Primary automatically forks replacement

Primary restart:

  • Closes cluster services
  • Exits cleanly
  • System service restarts application

Reboot

server.reboot();

Gracefully reboots the operating system after draining connections.


Shutdown

server.shutdown();

Gracefully powers off the machine after draining connections.


IPC Transport Engine

The IPC subsystem synchronizes Primary and Worker processes.

Broadcast:

server.send({
	method: "custom_worker_event",
	broadcast: true,
	data: {
		status: "ok"
	}
});

Target worker:

server.send({
	method: "restart",
	worker: 2
});

Multiple workers:

server.send({
	method: "drain",
	workers: [1, 3]
});

Reactive Cluster Storage Manager

Cluster-wide synchronized key/value storage.

await server.storage.set(
	"node_capacity",
	{
		availableSlots: 45
	}
);

const capacity =
	await server.storage.get(
		"node_capacity"
	);

const totalKeys =
	await server.storage.size();

await server.storage.delete(
	"node_capacity"
);

await server.storage.clear();

Reactive listeners:

server.storage.on(
	"change:node_capacity",
	(newValue) => {
		console.log(newValue);
	}
);

server.storage.on(
	"delete:node_capacity",
	() => {
		console.log("Deleted");
	}
);

Distributed Cluster Orchestration

Cluster communication is provided by @cocreate/server-mesh.

server.mesh.send({
	method: "mesh.custom_command",
	server: "server_b_id",
	data: {
		key: "value"
	}
});

Targeting Matrix & Routing Directives

| Target | Example | | --- | --- | | Single server | { server: "server_b_id" } | | Multiple servers | { server: ["server_b_id","server_c_id"] } | | Worker | { server: "server_b_id", worker: 2 } | | Broadcast | { broadcast: true } |


Self-Healing & Jittered Reconnection Logic

Peer reconnections use exponential backoff with randomized jitter.

$$ T_{delay}

\min \left( 30000, 1000\times1.5^{attempt} \right) + random(500,4500) $$

This prevents reconnect storms after temporary outages.


Dynamic Tenant Eviction & Cascading Teardown Sequence

Tenant lifecycle is driven by active socket connections.

$$ \text{Client Disconnect} \rightarrow \text{60 Second Grace Period} \rightarrow \text{Organization Removed} $$

Once the final client disconnects:

  1. A 60-second timer begins.
  2. Workers release tenant resources.
  3. Peer servers receive notification.
  4. Database pools, telemetry buffers, and mesh tunnels are released.

Security-Hardened Design

  • Mutual TLS encrypted cluster communication
  • Dedicated internal mesh network
  • Automatic UUID generation for distributed tracing
  • Ephemeral TLS certificates managed by @cocreate/certificates

Installation

NPM

npm install @cocreate/server

Yarn

yarn add @cocreate/server

Quick Start

import CoCreateServer from "@cocreate/server";

async function startServer() {
	const server =
		await CoCreateServer.init();

	server.on(
		"status_change",
		({ oldStatus, newStatus }) => {
			console.log(
				`${oldStatus} -> ${newStatus}`
			);
		}
	);
}

startServer();

Announcements

Release notes include new features, performance improvements, security updates, and compatibility changes. Follow the repository to stay informed about the latest releases.


Roadmap

Upcoming improvements include:

  • Enhanced cluster orchestration
  • Improved process supervision
  • Adaptive worker allocation
  • Expanded telemetry integration
  • Additional deployment adapters

How to Contribute

Community contributions are welcome.

Please review:

  • Documentation
  • CONTRIBUTING.md
  • GitHub Issues
  • GitHub Discussions

Bug reports, feature requests, documentation improvements, and pull requests are appreciated.


About

@cocreate/server is designed, built, and maintained by the CoCreate Developer Experience Team.

It serves as the core runtime responsible for process orchestration, clustering, networking, module composition, and lifecycle management across the CoCreate platform.


License

This software is dual-licensed under the GNU Affero General Public License version 3 (AGPLv3) and a commercial license.

Open Source

For open-source projects and non-commercial use, this software is available under the AGPLv3. See the LICENSE file for complete license terms.

Commercial

Organizations requiring proprietary use may obtain a commercial license from CoCreate.