I have developed a server-side Clojure app and have only played around with Clojurescript / Re-frame. But I am now preparing to make a transition into Clojurescript and feel like there are lots of important decisions that have to be made. First of all, Shadow-cljs or Figwheel-main? This post is not about that choice but I just want to give an example of exactly how early in the process I am.
The application that I will be developing is essentially an administrative interface to a database. So a lot of pages where the user basically checks checkboxes, enters values, creates new entries etc. There is some client-side logic for validating input and sometimes retrieving data from the server. And then there are a couple of more complex views where users can build reports of the data.
A full-blown SPA seems too advanced for this use-case. There seems to a lot of overhead with managing the browser history, gracefully handling reloads, handling conflicts between client- and server side data, etc. It seems a lot simpler to render most HTML server-side and send along some Clojurescript code to handle client side logic. Reagent seems to be a good general fit for this. However, I really like Re-frame (mostly from reading the re-frame readme) and I think that it may be suitable for the more advanced views. My reading of various blog posts suggests that when there are a more than a few components on a page that need to be synchronized, decentralized state management with reagent quickly becomes very complicated.
So, I guess that my questions are:
- Is it a feasible/good idea to mix reagent/re-frame in a mostly server-side application? Are there any examples of non-SPA re-frame apps?
- How does one go about having different “entry points” into the Clojurescript code in different server-side rendered pages? Most examples I have seen are SPAs where the client resolves the URL to determine what to do, or just single page examples where there is only one entry-point. Any examples would be very welcome.
I would be extremely grateful for any help! Please let me know if I can clarify in any way.