A full-stack variant of redux library that runs reducers and selectors on the server. It receives actions from clients over ajax and pushes realtime sub-state to clients over websocket.
- Centralized state management on the server
- single source of truth
- enforce integrity of update logics
- enforce access control
- no need to duplicate works on the backend and frontend
- Auto push realtime updates to multiple clients
- Support action result
- reducer returns a new state and an result value
- support success/error message
- no need to get action result using another selector
- Callback based selector and reducer
- Compatible with event sourcing architecture and CQRS pattern
- Reliable message channel
- Websocket auto reconnect when network resume
- Subscription message is buffered and auto resent when network resume
- Type-safe development
- with static type checking from Typescript
+-- common
\-- state.ts
\-- selector.ts
\-- reducer.ts
\-- index.ts (optional, export other 3 files for easier importing)
+-- server
\-- server.ts (express server and ws server)
+-- client
\-- components (use selector and dispatch action)
-
server loads initial state
-
client subscribes to selector
-
server passes initial sub-state from selector to client
-
client dispatches action to server
-
server runs reducer to build new state from current state and received action
-
server checks attached selectors and push new sub-state to clients (in any browser)
- Allow passing arguments to selector
- Support async selector
-
Setup authentication with JWT
To demo in example or provide built-in support
web-redux is inspired from redux and livestate
This project is licensed with BSD-2-Clause
This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:
- The freedom to run the program as you wish, for any purpose
- The freedom to study how the program works, and change it so it does your computing as you wish
- The freedom to redistribute copies so you can help others
- The freedom to distribute copies of your modified versions to others