Sockpuppet is a new way to craft modern, reactive web interfaces with Django.
We extend the capabilities of both Django and Stimulus by intercepting user interactions and passing them to Django over real-time websockets. These interactions are processed by Reflex actions that change application state. The current page is quickly re-rendered and the changes are sent to the client. The page is then morphed to reflect the new application state. This entire round-trip allows us to update the UI in 20-30ms without flicker or expensive page loads.
This architecture eliminates the complexity imposed by full-stack frontend frameworks without abandoning high-performance reactive user experiences. With Sockpuppet, small teams can do big things faster than ever before. We invite you to explore a fresh alternative to the Single Page App (SPA).
We are indebted to the work done in StimulusReflex. Without them Sockpuppet wouldn't exist; it's our bigger sibling who prefers to play in the Rails world.
Enable small teams to do big things, faster 🏃🏽♀️
Increase developer happiness ❤️❤️❤️
Facilitate simple, concise, and clear code 🤸
Integrate seamlessly with Django 🚝
Our friends at StimulusReflex proves that you can build things fast.
Applications nowadays pursue native UI speeds which spawned a new breed of increasingly complex technologies. Modern Single Page Apps have pushed much of the server's responsibilities to the client. Unfortunately, this new approach trades a developer experience that was once fun and productive for an alternative of high complexity and only marginal gains.
There must be a better way.
In his 2018 ElixirConf keynote, Chris McCord (creator of the Phoenix framework for Elixir) introduced LiveView, an alternative to the SPA. His presentation captures the same promise and excitement that Rails had in the early days.
We love Elixir and Phoenix. Elixir hits a sweet spot for people who want Rails-like conventions in a functional language. The community is terrific, but it's still small and comparatively niche.
Also, we just really enjoy using Django.
Sockpuppet was originally inspired by StimulusReflex which was inspired by LiveView, but we are charting our own course together with StimulusReflex. Our goal has always been to make building modern apps with Django the most productive and enjoyable option available. We want to inspire our friends working with other tools and technologies to evaluate how concepts like Sockpuppet could work in their ecosystems and communities.
So what is happening behind the scenes here? Sockpuppet works in three layers.
The HTML layer has the responsibility of defining where and how a "Reflex" is going to be triggered. Ie, a Reflex could be triggered by a browser event or the click of a button. When building more complex applications the HTML layer may also be used to store state so that this state is accessible when doing some interactivity in a stimulus controller.