Registry / web-framework / reapex

reapex

JSON →
library1.1.1jsnpmunverified

Reapex is a JavaScript framework designed for building scalable React applications, with a particular focus on micro-frontend architectures and robust state management. It is currently at version 1.1.1 and appears to be actively maintained, though a specific release cadence isn't explicitly stated. Key differentiators include its plugin system (e.g., for Immer integration), flexible state model supporting both immutable records and plain JavaScript objects, and built-in support for integrating with Redux Sagas for complex side effects. The framework abstracts away much of the boilerplate associated with Redux-like patterns, aiming to simplify state management and modular development in larger applications. Its design enables developers to extend its core functionality through plugins, adapting it to various architectural needs.

npm install reapex
INSTALL
IMPORT
SIG · REAPEX
R
reapex
web-frameworkjavascriptv1.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createApp
import { createApp } from 'reapex'
const createApp = require('reapex')
Used to initialize the Reapex application instance. While CommonJS might technically work, ESM is the recommended modern approach for React applications.
createModel
import { createModel } from 'reapex'
import createModel from 'reapex'
Used to define state models. This is a named export, not a default export.
useModel
import { useModel } from 'reapex'
import { useModel } from 'reapex/react'
The primary React hook for consuming Reapex models within components. It's a top-level named export.
App
import type { App } from 'reapex'
Importing the TypeScript type for the Reapex application instance. This is a type-only import.

This quickstart demonstrates how to set up a Reapex application, define a state model with reducers and effects (Sagas), and consume it within a React component using the `useModel` hook.

import { createApp, createModel, useModel } from 'reapex'; import React from 'react'; import ReactDOM from 'react-dom'; // 1. Create a Reapex App instance const app = createApp(); // 2. Define a Model const counterModel = createModel({ name: 'counter', state: { value: 0 }, reducers: { increment: (state) => ({ ...state, value: state.value + 1 }), decrement: (state) => ({ ...state, value: state.value - 1 }), set: (state, payload: number) => ({ ...state, value: payload }), }, effects: { *incrementAsync() { yield new Promise(resolve => setTimeout(resolve, 1000)); yield counterModel.reducers.increment(); }, }, }); // 3. Register the model with the app app.model(counterModel); // 4. Create a React component to consume the model const CounterComponent = () => { const [state, actions] = useModel(counterModel); return ( <div> <h1>Counter: {state.value}</h1> <button onClick={actions.increment}>Increment</button> <button onClick={actions.decrement}>Decrement</button> <button onClick={() => actions.incrementAsync()}>Increment Async</button> <button onClick={() => actions.set(0)}>Reset</button> </div> ); }; // 5. Mount the application ReactDOM.render( <React.StrictMode> <CounterComponent /> </React.StrictMode>, document.getElementById('root') );
Debug
Known issues
breakingThe initial state configuration for models underwent a breaking change in version 1.0.0-beta.2. This release also introduced support for plain JavaScript objects as model states, whereas previous versions only supported Immutable.js Records.
fix
Review model initial state definitions and update to reflect the new structure. If using Immutable.js, consider migrating to plain objects with an Immer plugin for simpler state management.
affects: >=1.0.0-beta.2
breakingThe `actionTypeDelimiter` option was removed from the App constructor. Reapex now enforces the use of `/` as the action type delimiter, simplifying action type generation and consistency.
fix
Remove `actionTypeDelimiter` from your `createApp` configuration. Ensure any custom action type generation or parsing expects `/` as the delimiter.
affects: >=0.12.0
breakingSubscribers to model changes now receive the entire action object as an argument, rather than just the payload. This provides more context for handling state updates.
fix
Update any subscriber functions to correctly deconstruct or access properties from the full action object instead of expecting only the payload directly.
affects: >=0.11.0
breakingThe peer dependencies `react`, `react-redux`, and `react-dom` were removed. Reapex no longer expects these to be installed as peer dependencies, giving applications more control over their React ecosystem versions.
fix
No direct fix needed for Reapex itself, but ensure your project explicitly declares and manages its own `react`, `react-redux`, and `react-dom` dependencies.
affects: >=0.11.0
breakingReducers and Sagas can no longer be passed directly into the `App` constructor configuration. This change was implemented to prevent circular import issues when migrating existing React/Redux applications to Reapex.
fix
Instead of passing `reducers` and `sagas` to `createApp`, use `app.setExternalReducers()` and `app.runSaga()` after the app has been initialized to register them.
affects: >=0.10.0
gotchaWhen using effects, the `trigger` map now supports `throttle`, `debounce`, and `takeLeading` options. Misunderstanding their behavior can lead to unintended side effects or performance issues.
fix
Carefully review the documentation for `throttle`, `debounce`, and `takeLeading` when applying them to effects to ensure the desired behavior for concurrent effect execution.
affects: >=0.12.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'reducers')
Attempting to register reducers or sagas via the `App` constructor config after version 0.10.0, which no longer accepts them directly.
fix
Use `app.setExternalReducers(yourReducers)` and `app.runSaga(yourSaga)` methods after initializing the app with `createApp()`.
TS2345: Argument of type '{ name: string; state: {}; reducers: {}; effects: {}; }' is not assignable to parameter of type 'ModelConfig<S, R, E>'.
Type errors related to `strictFunctionTypes` or incorrect `ModelConfig` definition, often seen with TypeScript version updates.
fix
Ensure your TypeScript configuration is compatible, and review model definitions for correct type annotations, especially for reducers and effects, as per the Reapex API.
Error: Action type 'my/action' does not match expected delimiter '/'
Custom action type delimiters were used, but Reapex now enforces `/` as the standard delimiter since version 0.12.0.
fix
Remove any custom `actionTypeDelimiter` configuration and ensure all action types are structured using `/` (e.g., `modelName/actionName`).
Error: The Immutable Record is expected but plain object is received.
Attempting to use plain JavaScript objects for state in versions prior to 1.0.0-beta.2, which only supported Immutable.js Records.
fix
Upgrade Reapex to version 1.0.0-beta.2 or later, or ensure your state is an Immutable.js Record if using an older version without the Immer plugin.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
immutableoptionalPeer dependency for versions up to 0.10.1 if using Immutable.js records for state. Not strictly required if using plain objects with a plugin like immer.
Agent activity
4 hits · last 30 days
node
4
Resources