drozdzynski
Storex is a frontend store with state management handled on the backend. It allows you to update the store state both from the frontend and backend, with all communication occurring over WebSocket.
More info available on Github.
Why Storex?
Features
-
Efficient state management: Only the differences (diffs) in the store state are sent with each mutation, minimizing data transfer.
-
Real-time updates: State changes are immediately reflected across all connected clients via WebSocket communication.
-
Backend-driven state: Storex allows both the frontend and backend to update the store state seamlessly.
-
Lightweight and fast: Designed for minimal overhead, ensuring rapid state updates and communication.
Key Differences from Phoenix LiveView
Phoenix LiveView is a powerful tool for building rich, interactive web applications without writing custom JavaScript. However, as your application grows, managing complex client-side state across multiple LiveViews or components can become challenging. This is where Storex comes in.
-
Client-Side State Management: While Phoenix LiveView handles server-side rendering and event handling, Storex focuses on managing state on the client side. It allows you to keep your client-side state in sync with the server, but with more flexibility in how that state is stored, updated, and accessed.
-
Decoupled State Logic: Storex decouples state management from the LiveView itself, enabling you to manage state across multiple components or even across the entire application. This contrasts with LiveView, where state is typically tied to a specific LiveView process.
-
Predictable State Updates: Storex follows a predictable, unidirectional data flow similar to Redux. This makes it easier to reason about state changes and debug issues, especially in complex applications.
-
Extensibility: Storex is designed to be highly extensible, allowing you to integrate it with other tools and libraries in the Elixir ecosystem. You can also define custom middleware to handle side effects, logging, or other tasks.
For an overview of Storex in action, check out the example provided here.
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
drozdzynski
Hello,
I want to announce that stex was renamed to storex and published to hex.pm with version
0.1.0.Changelog:
Links:
drozdzynski
Version
0.2.0releasedChangelog:
Storewhen stopped on disconnectal2o3cr
@drozdzynski FYI, I noticed the title of the thread was out-of-sync with the new name and adjusted it.
drozdzynski
Version
0.2.2releasedChangelog:
Version
0.2.3releasedChangelog:
Sebb
That’s interesting.
Do you think it would be feasible to add fw-specific wrappers around Storex, so that we could (for example) use a SolidJS store transparently?
So (in this case) Solid’s reactive system could create an event, which is (maybe) processed in the backend (without any further ado) which then modifies the store which then leads to a reaction (without further ado) on the client side…?
drozdzynski
I designed it as a replacement for frontend stores.
If you want to use it with SolidJS you can use from function to display the current state.
Example:
Sebb
Thats very nice. So Storex on the client side acts as an observable (implementing
subscribe)…?I’ve only played a little with SolidJS, so I can’t say if there are any drawbacks (besides having to “learn” the Storex API for writing). If it works as I think (have to try it out) this just rocks. Liveview is really great, but I’ve a project now, that is so dynamic that I need a frontend framework. This could bring one of the biggest benefits of LV - removing all the layers between backend and frontend - to any (reactive?) framework (implementing sth like
from)drozdzynski
Yes, storex has the
subscribemethod inStoreto work with reactivity.I’m using storex with
sveltefrontend framework which works onsubscribemethod on reactivity.Example:
Sebb
I finally had the time to check this out. Looks very promising.
Some things I noticed (I have very limited JS-skills, so may be bullshit)
constwithvarhere:subscribe: (state) => {var state = state}(does not work otherwise)I created a sample app. Especially the websocket handling is not obvious, I used GitHub - kevinlang/plug_socket: Add Cowboy websockets to your Plug.Router easily. · GitHub which makes that easy.
Sample app: GitHub - georgfaust/storex_example_app: solidjs examples for https://github.com/nerdslabs/storex · GitHub
drozdzynski
You are right, it’s my mistake, I will update README
I tested that as well and it’s a bug, thanks for catching that
I will fix it with this integer as a state