nexus

Installation

Install Core with the adapter for your application.

Install @nexus-js/core and the adapter that connects your JavaScript contexts. Choose one of the following setups.

Chrome Extensions

For communication between background, content scripts, and extension pages:

pnpm add @nexus-js/core @nexus-js/chrome

Continue with the quick start to provide and call your first service.

Parent Pages And Iframes

For communication between a parent window and an embedded iframe:

pnpm add @nexus-js/core @nexus-js/iframe

Configure the two contexts using the iframe guide.

Local Node Processes

For communication between a local daemon and clients over Unix sockets:

pnpm add @nexus-js/core @nexus-js/node-ipc

Configure the daemon and client using the Node IPC quick start.

Controlled WebSocket Clients

For browser, WebView, or Node clients connecting to a controlled Node service:

pnpm add @nexus-js/core @nexus-js/websocket

Configure the server and clients using the WebSocket guide.

Other Transports

If your application supplies its own endpoint, install Core:

pnpm add @nexus-js/core

See platforms and custom endpoints for the transport contract. Ordinary application code can use an existing adapter instead.

Next Step

Once both contexts are configured, the Core workflow is the same:

const connection = await app.connect({ target });
const service = connection.get(ServiceToken);
const result = await service.method();

The quick start supplies the shared contract, provider, and consumer for a complete example. Additional capabilities can be added later; see the package reference.

Edit this page on GitHub