
Luminus – A Clojure Web Framework - Naac
https://luminusweb.com/
======
vga805
"Reagent is the recommended approach for building ClojureScript applications
with Luminus."

Reagent is nice, but if you want global state management, re-frame adds most
familiar concepts from redux but without as much boilerplate:
[https://github.com/day8/re-frame](https://github.com/day8/re-frame)

~~~
hellofunk
re-frame still adds way too much boilerplate for my tastes, especially on solo
projects. I personally greatly prefer to use reagent directly over using re-
frame.

~~~
pgt
Yes. I now use Rum + Datascript + core.async for event sourcing. Here is the
entirety of my reactive event-loop handling, inspired by Tonsky's Cat Chat
([https://tonsky.me/blog/datascript-chat/](https://tonsky.me/blog/datascript-
chat/)):

    
    
        ; One Macro in events.clj:
    
        (defmacro go-loop-sub [pub key binding & body]
          (let [[db-bind & bindings] binding]
            `(let [ch# (cljs.core.async/chan)]
               (cljs.core.async/sub ~pub ~key ch#)
               (go-loop []
                 (let [event# (rest (cljs.core.async/<! ch#))
                       ~db-bind @yourproject.data.core/conn
                       ~(vec bindings) event#
                       result# (do ~@body)]
                   (when result#
                     (yourproject.data.core/transact! yourproject.data.core/conn result#)))))
                 (recur)))))
    
        ;; Usage (at top of core file)
    
        (defonce conn (d/create-conn schema))
        (defonce event-bus (async/chan))
        (defonce event-pub (async/pub event-bus first))
    
        ;; For each event you want to dispatch on:
    
        (go-loop-sub event-pub :todo/add-item [db {:as data :keys [text]}]
          ;; Query db here. Any tx-data you return will get transacted.
          [{:db/id -1
            :todo/text text}])
    
        ;; To display some reactive queries in DataScript:
    
        (rum/defc root-component
          < rum/reactive [conn]
          (let [db (rum/react conn)
                todos (d/q '[:find ?todo ?text
                             :where [?todo :todo/text ?text]]
                           db)]
            [:div "Todos: " (pr-str todos)]))
    

That's it. You don't need re-frame.

~~~
freshhawk
I use those same 3 in a similar way, it's great. I do really appreciate the
design of the effects/coeffects concept in re-frame, I often use that concept.
I just don't find I ever need re-frame.

------
yayitswei
Fulcro is also worth a look. I've been using it for a few projects and have
been happy with it so far.

~~~
tvaughan
We just re-evaluated our choices and selected Fulcro. Below is a slightly
edited version of how we came to this conclusion.

As a business building an extremely ambitious product on a tight budget, we
want to be able to:

* Focus as much time and thought on building features that bring value to our customers, rather than, for example, building a bespoke protocol between the browser and back-end if a better alternative is available.

* Share early iterations of our application with everyone in our organization easily. Capture feedback and push out new iterations quickly.

* Be able to support new customers immediately. Our feature road-map will always be in constant flux, but at no point should our ability to make changes with confidence be compromised. In addition to feature development, tests and automation must be priorities. Our development and production environments must match.

* Be ready to onboard new team members. "Works on my laptop" is never acceptable. Enough of our application must be documented and automated so that anyone with a technical background "reasonably proficient" in our work can contribute without requiring hand-holding. Or course, we'd never turn down a request for help.

Our requirements are:

* Clojure, Clojurescript, and Datomic are immutable choices. We love these solutions for their simplicity and expressiveness. We believe these are the best choices available for achieving our long-term business goals.

* Be measurable. Our work should be guided by data not guesswork.

* Be testable. The entire application should have 100% test coverage as measured by its acceptance or integration tests (not unit tests). Changes should be made with confidence.

* Be performant. As builders of both the front-end and back-end components, we should encourage cooperation between them, not purposefully isolate them. Our customers and the end-user experience should be our priorities, not artificial divisions between software components or technical teams. Each component of the application should cooperate to support progressive enhancement where every URL is a real URL that, when requested, returns a server-side rendered page view. Further actions by the user result in browser-side changes through API calls and minimal component updates.

* Be pragmatic. We should be eager to innovate when the need arises. However, we should be humble enough to understand that sometimes, as software developers, we can become enamored with new toys that are entertaining, and possibly educational, but offer little business value. We should choose existing solutions to our problems that are acceptable enough over building our own solutions simply because we want to. For example, a standards-based protocol, like [https://github.com/edn-query-language/eql](https://github.com/edn-query-language/eql), that allows clients to craft their own queries with little to no server-side updates is preferable to our current bespoke solution.

* Be documented and supported. Our choices should have active, helpful, and inclusive development communities built around them.

Our choices are:

* Rum, [https://github.com/tonsky/rum](https://github.com/tonsky/rum)
    
    
      Rum is a solid piece of software, created and maintained by @tonsky, that
      provides a minimal wrapper around react for creating client-side components,
      and supports server-side rendering. Although rum does not provide a protocol
      between client and server, nor a client component state-management solution.
    

* Reagent, [https://github.com/reagent-project/reagent](https://github.com/reagent-project/reagent)
    
    
      Together with Re-frame, https://github.com/Day8/re-frame, this is by far the
      most popular choice for building reactive client components in
      Clojurescript. These do not include the server-side solutions we need.
    

* Hoplon, [http://hoplon.io](http://hoplon.io)
    
    
      Hoplon was created in-house at AdZerk, and later spun-out as an open source
      project. Hoplon is a complete solution although it uses a less intuitive
      spreadsheet-like method for building applications with little obvious
      advantage, and would not be compatible with Datomic without considerable
      effort.
    

* Luminus, [https://luminusweb.com](https://luminusweb.com)
    
    
      Luminus is a complete solution like Ruby-on-Rails, and is tightly coupled to
      SQL. Like Hoplon, Luminus would not be compatible with Datomic without
      considerable effort.
    

* Pedestal, [http://pedestal.io](http://pedestal.io)
    
    
      Pedestal is supported by Cognitect, the custodians of Clojure and the
      creators of Datomic. Except Pedestal is best suited for building server-side
      APIs, and applications that need to stream data in "near real-time" to large
      numbers of concurrently connected clients.
    

* Fulcro, [https://fulcro.fulcrologic.com/](https://fulcro.fulcrologic.com/)
    
    
      Fulcro is based on Om.Next, provides both front-end and back-end components
      that work well together, includes tools for building and debugging both,
      supports server-side rendering, and is supported by a diverse
      community. Paid commercial support is provided by the core developer team at
      Fulcro Logic.
    

* Datomic Cloud, [https://www.datomic.com](https://www.datomic.com)
    
    
      Datomic Cloud is a special version of the Datomic database that is tightly
      integrated with AWS. Datomic Cloud includes a set of Cloud Formation
      templates for running Datomic in AWS, and taking advantage of AWS specific
      features, such as auto-scaling groups and load-balancers for distributing
      traffic across a cluster of Datomic peers. Datomic Cloud also includes Ions,
      https://docs.datomic.com/cloud/ions/ions.html, to help run Clojure functions
      as AWS Lambdas. Cognitech claims Datomic Cloud is a suitable framework for
      building complete applications. Unfortunately Datomic Cloud alone is
      insufficient. Datomic Cloud lacks a framework for building and testing
      client-side applications, and a protocol for interacting with Ions.

~~~
subsaharancoder
Did you consider re-frame?

~~~
tvaughan
Yes, we considered both reagent and re-frame together. Around the time om.next
was announced myself and a handful of others built a commercial product based
on reagent, re-frame, and om.next. I only have good things to say about them,
but there's a lot that they don't do and Fulcro's client-side solution is
equally pleasant.

------
cube2222
If you're interested in this, check out the book about web development in
clojure[0] from the author of luminus, I haven't yet read it all, but I really
liked the first few chapters.

[0]: [https://pragprog.com/book/dswdcloj3/web-development-with-
clo...](https://pragprog.com/book/dswdcloj3/web-development-with-clojure-
third-edition)

------
devgoth
I tried using Luminus once and got super super super super super confused
since I am new to Clojure development. I ended up learning the basics with
Ring, Compojure, and Component.

I felt like learning these things separately vs. learning something like
Luminus was way better to understand what was going on "under the hood". I bet
if I went back to try Luminus now I would enjoy it but from my experience it
was not very beginner friendly.

------
ertucetin
If you want to build simple/basic routing + RESTful services I suggest:
[https://github.com/ertugrulcetin/patika](https://github.com/ertugrulcetin/patika)

Disclaimer: I wrote it.

------
lwb
Is this new? Or are there some new features? When I was writing Clojure a few
years ago I thought that Luminus was the name of the framework of choice then.

~~~
bgorman
I don't really think Luminus is really a framework, it is more like a template
to get started with a curated list of libraries that has changed over time.

I believe Luminus has had some pretty major changes over the years such as
changing the default webserver, routing library and dependency injection
system.

~~~
simongray
Yup, Luminus is really just a curated (and occasionally updated) set of
libraries put together by
[https://github.com/yogthos](https://github.com/yogthos)

Most Clojure devs find frameworks in the traditional sense quite limiting.
Fulcro is probably the most framework-like thing in Clojure-land at the
moment.

------
smnplk
The other template i like is chestnut
[https://github.com/plexus/chestnut](https://github.com/plexus/chestnut)

------
dimovich
Another backend mini-framework is Roll.

[https://github.com/dimovich/roll](https://github.com/dimovich/roll)

