Overview

This page lists the ESP packages, defines a store and a model, and shows how an ESP app fits together.

The packages

ESP is four packages. They share one version number.

Package What it does Needs
esp-js The EventBus. You register stores on it, publish events to them, and observe their models. nothing
esp-js-di A dependency injection container. nothing
esp-js-ui Builds an app out of modules, each with its own container, stores, and views. esp-js, esp-js-di
esp-js-react React components and hooks that render a store’s model. esp-js, esp-js-ui, React 19

You can use esp-js or esp-js-di on its own. For the install commands, see installation.

Stores and models

A store is what you register on the bus under a storeId. It holds the event handlers, effects, and other parts that StoreBuilder adds.

A store’s model is its state: a frozen object that the bus replaces each time the store’s handlers change it. Observers get the new model after the store’s events are handled.

An app

An esp-js-ui app has a root container, one or more modules, and a shell that shows the modules’ views.

An esp-js-ui app: the root container holds the bus and the app services; each module has a child container, stores on the bus, and view bindings; RegionViews in the shell show the views

  • The root container holds the EventBus, registered as 'bus', and the services the whole app uses. See services.
  • Each module has a child container. It registers its stores on the bus, and binds a view to each store with withView. See modules and views.
  • The shell is a React component. Its RegionView components show the views bound to each region. See regions.
  • AppBuilder builds the app, and start() runs the modules’ hooks in a fixed order. See bootstrapping.

If you’re moving an app from ESP v8, see migrating from v8.