@datalayer/reactor
v1.0.0
Published
Extension reactor with framework-agnostic core and React bridge
Readme
🔌 Reactor
Reactor provides two sibling packages in one repository, with no python/typescript subpackage folders:
datalayer_reactor(PyPI distribution, imported asreactor): FastAPI + pluggy plugin reactor for modular and SaaS-style extensibility.@datalayer/reactor(TypeScript): Extension runtime with a framework-agnostic core and separate React integration.
Why Reactor
This project targets a full extension reactor, not only hook callbacks:
- Platform architecture with lifecycle phases and dependency graph
- Plugin marketplace metadata and discovery primitives
- Third-party ecosystem support through explicit manifest contracts
- Dynamic feature loading and runtime enable/disable
- Modular app concerns: interdependencies, lifecycle management, compatibility checks
- SaaS extensibility primitives: tenant-specific plugin activation, sandboxed execution, versioned compatibility
Repository Layout
src/: TypeScript package source for@datalayer/reactorreactor/: Python package sourceexamples/frontend/: frontend-only React + Primer UI demoexamples/frontend-backend/: combined React + Python demo
TypeScript Package: @datalayer/reactor
Design
The TypeScript runtime implements:
defineExtensionandconfigExtensiondependencies,peerDependencies,conflictsWith- ordered phases:
init->build->register->afterRegistration - runtime lifecycle control:
start,stop,enable,disable - signal primitives for reactive extension outputs:
signal,computed,effect,batch,untrackednamedSignals,watchedSignal
Core vs React split
- Core runtime exports from
@datalayer/reactor - React bindings export from
@datalayer/reactor/react
React bindings include:
useReactor: register the reactor in the zustand store and manage its lifecycleReactorSlot: render plugin-provided components by named slotuseReactorPlatform: reactor access for runtime toggles
Build
npm install
npm run buildMinimal TypeScript usage
import { buildReactorFromExtensions, defineExtension } from '@datalayer/reactor';
const DemoExtension = defineExtension({
name: '@demo/core',
build() {
return { message: 'hello' };
},
});
const reactor = buildReactorFromExtensions([DemoExtension]);
reactor.start();Python Package: datalayer_reactor
Capabilities
- Pluggy-powered plugin registration (
register_plugin) - Compatibility and dependency checks via
PluginManifest - Runtime enable/disable globally and by tenant
- Marketplace publication/listing (
PluginMarketplace) - Sandboxed execution option for plugin calls
- FastAPI control plane with plugin/tenant endpoints
Install and run
python -m venv .venv
source .venv/bin/activate
pip install -e .
python -m reactorAPI app endpoints
GET /pluginsPOST /plugins/{plugin_name}/togglePOST /tenants/plugins/{plugin_name}/toggleGET /tenants/{tenant_id}/featuresGET /tenants/{tenant_id}/routesGET /marketplace
Minimal Python usage
from reactor import PluginManifest, PluginCompatibility, PluginPlatform
reactor = PluginPlatform()
reactor.register_plugin(
PluginManifest(
name="greeting-plugin",
version="1.0.0",
compatibility=PluginCompatibility(api_version="v1"),
),
plugin_impl=object(),
)