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

@nlabs/arkhamjs-middleware-redux

v3.29.7

Published

Integrate ArkhamJS state management within Redux

Readme

@nlabs/arkhamjs-middleware-redux

Redux Compatibility Layer for ArkhamJS - Seamlessly integrate ArkhamJS into existing Redux applications or migrate from Redux to ArkhamJS with zero downtime.

npm version npm downloads Travis Issues TypeScript MIT license Chat

🚀 Features

  • 🔄 Two-Way Binding - Bidirectional state synchronization between Redux and ArkhamJS
  • 🚀 Zero-Downtime Migration - Migrate from Redux to ArkhamJS gradually
  • 🎯 Selective Integration - Choose which parts of your Redux store to integrate
  • ⚡ Performance Optimized - Efficient state synchronization without performance impact
  • 🔧 Flexible Configuration - Multiple integration patterns for different use cases
  • 📱 Existing Redux Support - Keep your existing Redux setup while adding ArkhamJS features
  • 🌲 Tree-shakable - Only include what you need

📦 Installation

npm install @nlabs/arkhamjs-middleware-redux

🎯 Quick Start

Basic Integration

import { createArkhamStore } from '@nlabs/arkhamjs-middleware-redux';
import { Flux } from '@nlabs/arkhamjs';
import { Provider } from 'react-redux';
import { reducers } from './reducers';

// Initialize ArkhamJS
Flux.init({ name: 'myApp' });

// Create Redux store with ArkhamJS integration
const store = createArkhamStore({
  flux: Flux,
  reducers,
  statePath: 'app' // Sync Redux state to ArkhamJS at 'app' path
});

// Use with existing Redux Provider
render(
  <Provider store={store}>
    <App />
  </Provider>,
  document.getElementById('root')
);

Gradual Migration

import { arkhamMiddleware } from '@nlabs/arkhamjs-middleware-redux';
import { applyMiddleware, createStore } from 'redux';

// Add ArkhamJS middleware to existing Redux store
const store = createStore(
  reducers,
  applyMiddleware(arkhamMiddleware('app'))
);

// Now Redux actions are automatically relayed to ArkhamJS
// You can gradually migrate components to use ArkhamJS

🔧 API Reference

createArkhamStore(options)

Create a Redux store with full ArkhamJS integration.

const store = createArkhamStore({
  flux: Flux,                    // ArkhamJS Flux instance
  reducers,                      // Redux root reducer
  statePath: 'app',              // State tree path for ArkhamJS
  arkhamMiddleware: [],          // Additional ArkhamJS middleware
  devTools: false,               // Enable Redux DevTools
  reduxMiddleware: []            // Additional Redux middleware
});

Options:

  • flux - (Flux) The Flux object initialized in your app
  • reducers - (Reducer) Redux root reducer (from combineReducers())
  • statePath - (string|string[]) State tree path where to set this branch
  • arkhamMiddleware - (any[]) Optional ArkhamJS middleware
  • devTools - (boolean) Enable/disable Redux DevTools (default: false)
  • reduxMiddleware - (Middleware[]) Additional Redux middleware

ReduxMiddleware(store, name)

ArkhamJS middleware to relay dispatched actions to Redux.

import { ReduxMiddleware } from '@nlabs/arkhamjs-middleware-redux';

const store = createStore(reducers);
const middleware = [new ReduxMiddleware(store, 'myApp')];

Flux.init({ middleware });

Parameters:

  • store - (Store) Redux root store
  • name - (string) Optional middleware name (should be unique)

arkhamMiddleware(statePath)

Redux middleware to relay Redux action dispatches to ArkhamJS.

import { arkhamMiddleware } from '@nlabs/arkhamjs-middleware-redux';
import { applyMiddleware, createStore } from 'redux';

const store = createStore(
  reducers,
  applyMiddleware(arkhamMiddleware('myApp'))
);

Parameters:

  • statePath - (string|string[]) State tree path for ArkhamJS

🎨 Integration Patterns

Pattern 1: Full Integration

Replace your Redux store entirely with ArkhamJS integration:

import { createArkhamStore } from '@nlabs/arkhamjs-middleware-redux';
import { Flux } from '@nlabs/arkhamjs';
import { Logger } from '@nlabs/arkhamjs-middleware-logger';
import { BrowserStorage } from '@nlabs/arkhamjs-storage-browser';

// Initialize ArkhamJS with full features
Flux.init({
  name: 'myApp',
  storage: BrowserStorage,
  middleware: [Logger()]
});

// Create integrated store
const store = createArkhamStore({
  flux: Flux,
  reducers: rootReducer,
  statePath: 'app',
  devTools: true
});

// Use with existing Redux components
render(
  <Provider store={store}>
    <App />
  </Provider>,
  document.getElementById('root')
);

Pattern 2: Gradual Migration

Keep existing Redux setup and add ArkhamJS features:

import { arkhamMiddleware } from '@nlabs/arkhamjs-middleware-redux';
import { applyMiddleware, createStore } from 'redux';

// Existing Redux setup
const store = createStore(
  reducers,
  applyMiddleware(
    // Existing middleware
    thunk,
    logger,
    // Add ArkhamJS integration
    arkhamMiddleware('app')
  )
);

// Now you can use both Redux and ArkhamJS
// Redux actions are automatically relayed to ArkhamJS
// You can gradually migrate components to use ArkhamJS hooks

Pattern 3: Selective Integration

Integrate only specific parts of your Redux store:

import { createArkhamStore } from '@nlabs/arkhamjs-middleware-redux';

// Create separate stores for different parts
const userStore = createArkhamStore({
  flux: Flux,
  reducers: userReducer,
  statePath: 'user'
});

const cartStore = createArkhamStore({
  flux: Flux,
  reducers: cartReducer,
  statePath: 'cart'
});

// Keep other parts as pure Redux
const mainStore = createStore(otherReducers);

🔄 Migration Strategies

Strategy 1: Side-by-Side Migration

// Keep existing Redux components
function OldReduxComponent() {
  const users = useSelector(state => state.users);
  const dispatch = useDispatch();

  return (
    <div>
      {users.map(user => (
        <div key={user.id}>{user.name}</div>
      ))}
    </div>
  );
}

// Create new ArkhamJS components
function NewArkhamComponent() {
  const users = useFluxState('user.list', []);
  const dispatch = useFluxDispatch();

  return (
    <div>
      {users.map(user => (
        <div key={user.id}>{user.name}</div>
      ))}
    </div>
  );
}

// Both work together seamlessly
function App() {
  return (
    <div>
      <OldReduxComponent />
      <NewArkhamComponent />
    </div>
  );
}

Strategy 2: Feature-by-Feature Migration

// Start with one feature
const userStore = createArkhamStore({
  flux: Flux,
  reducers: userReducer,
  statePath: 'user'
});

// Migrate user-related components to ArkhamJS
function UserProfile() {
  const user = useFluxState('user.current', null);
  return <div>Welcome, {user?.name}!</div>;
}

// Keep other features in Redux
const mainStore = createStore(otherReducers);

Strategy 3: Complete Migration

// Migrate everything at once
const store = createArkhamStore({
  flux: Flux,
  reducers: rootReducer,
  statePath: 'app',
  devTools: true
});

// All components can now use ArkhamJS features
function App() {
  return (
    <Provider store={store}>
      <AllComponents />
    </Provider>
  );
}

🎯 Use Cases

Adding ArkhamJS Features to Redux

import { arkhamMiddleware } from '@nlabs/arkhamjs-middleware-redux';
import { Logger } from '@nlabs/arkhamjs-middleware-logger';
import { BrowserStorage } from '@nlabs/arkhamjs-storage-browser';

// Initialize ArkhamJS with features
Flux.init({
  name: 'myApp',
  storage: BrowserStorage,
  middleware: [Logger()]
});

// Add to existing Redux store
const store = createStore(
  reducers,
  applyMiddleware(arkhamMiddleware('app'))
);

// Now you have:
// ✅ Redux DevTools
// ✅ ArkhamJS logging
// ✅ State persistence
// ✅ Event-driven architecture
// ✅ All existing Redux functionality

Gradual Component Migration

// Phase 1: Add ArkhamJS integration
const store = createStore(reducers, applyMiddleware(arkhamMiddleware('app')));

// Phase 2: Migrate one component at a time
function UserList() {
  // Old Redux way
  const users = useSelector(state => state.users);

  // New ArkhamJS way
  const users = useFluxState('app.users', []);

  return <div>{/* component content */}</div>;
}

// Phase 3: Remove Redux dependencies
// Eventually remove useSelector and useDispatch

Hybrid Architecture

// Use Redux for complex state logic
const complexReducer = (state, action) => {
  // Complex Redux logic
  return newState;
};

// Use ArkhamJS for simple state and events
Flux.dispatch({ type: 'USER_CLICKED', userId: 123 });

// Both work together seamlessly
const store = createArkhamStore({
  flux: Flux,
  reducers: { complex: complexReducer },
  statePath: 'complex'
});

🔗 Related Packages

📚 Documentation

For detailed documentation and examples, visit arkhamjs.io.

🤝 Community & Support

📄 License

MIT License - see LICENSE file for details.