Think in Terms of Application Components
Web Development with Clojure, Third Edition — by Dmitri Sotnikov, Scot Brown (22 / 107)
👈 Manage the Project | TOC | Managing Stateful Components 👉
The approach that a typical Clojure web application takes is probably different from what you’re used to. Most frameworks favor using the model-view-controller (MVC) pattern for partitioning the application logic, with strong separation between the view, the controller, and the model.
Luminus doesn’t enforce any strict separation between the view and the controller portion of the application. Instead, Luminus encourages organizing the application to keep related code in the same namespace. The route handler functions are typically responsible for processing HTTP requests from the client and dispatching actions based on them. This approach provides a clean separation between the domain logic and the presentation layer of your application without introducing any unnecessary indirection.
But since the Clojure web stack is designed to be flexible, it will let you build your applications any way you like. If you do feel strongly about using a traditional MVC architecture, nothing will stop you from doing that.
A typical application is broken up into several logical components.
Let’s look at these in more detail. A Luminus application is typically composed of the following core namespaces: