Home

Awesome

Luminus-Template

Clojars Project

A Leiningen template for projects using Luminus.

The template initializes a base Luminus application.

Requirements

Luminus requires Leiningen version 2.5.3+

Usage

The Luminus template ships out of the box with your latest Leiningen. Run the following command to create a new Luminus project which uses the default profile template:

lein new luminus <your project name>

However, if you would like to attach further functionality to your template you can append profile hints for these extended features:

ProfileCategoryDescriptionCompare
+alephserveradds the Aleph serverdiff
+http-kitserveradds the fast HTTP Kit web server to the projectdiff
+immutantserveradds the immutant web server to the project. Note: this project is no longer funded/maintaineddiff
+jettyserveradds the jetty web server to the projectdiff
+undertowserveradds the ring-undertow server. This is a default server.diff
+h2databaseadds db.core namespace and H2 database dependenciesdiff
+postgresdatabaseadds db.core namespace and PostgreSQL database dependenciesdiff
+mysqldatabaseadds db.core namespace and MySQL/MariaDB database dependenciesdiff
+mongodbdatabaseadds support for MongoDB using the Monger librarydiff
+datomicdatabaseadds support for the Datomic databasediff
+sqlitedatabaseadds support for the SQLite databasediff
+xtdbdatabaseadds support for the XTDB databasediff
+graphqlservice APIadds GraphQL support using Laciniadiff
+swaggerservice APIadds support for Swagger-UIdiff
+serviceservice APIremoves static assets and the layout, adds Swagger supportdiff
+cljsClojureScriptadds ClojureScript support to the projectdiff
+reagentClojureScriptadds ClojureScript support with Reagent to the project along with an examplediff
+re-frameClojureScriptadds ClojureScript support with re-frame to the project along with an examplediff
+kee-frameClojureScriptadds kee-frame to the projectdiff
+shadow-cljsClojureScriptadds shadow-cljs support to the project, replacing the default cljsbuild and figwheel setupdiff
+bootmisccauses the project to run with Boot instead of Leiningendiff
+authmiscadds Buddy dependency and authentication middlewarediff
+auth-jwemiscadds Buddy dependency with the JWE backenddiff
+oauthmiscadds OAuth dependencydiff
+hoplonmiscadds ClojureScript support with Hoplon to the projectdiff
+cucumbermiscadds support for browser based UI testing with Cucumber and clj-webdriverdiff
+sasscmiscadds support for SASS/SCSS files using SassC command line compilerdiff
+warmiscadds support of building WAR archives for deployment to servers such as Apache Tomcat (should NOT be used for Immutant apps running on WildFly)diff
+sitemisccreates template for site using the specified database (H2 by default) and ClojureScriptdiff
+kibitmiscadds lein-kibit plugindiff
+servletmiscadds middleware for handling Servlet contextdiff
+basicmiscgenerates a bare bones luminus projectdiff
+asyncmiscsupport for async (= 3 argument) ring handlers

To add a profile simply pass it as an argument after your application name, e.g.:

lein new luminus myapp +cljs

You can also mix multiple profiles when creating the application, e.g.:

lein new luminus myapp +auth +postgres

To build as a executable Java ARchive (JAR) standalone, run the following command:

lein uberjar

Or if using the +boot profile:

boot uberjar

To run the resulting standalone executable .jar file, do as you would with any other:

user$ java -jar target/myapp.jar
15-Sep-14 16:06:21 APc47d.4f39.65e6.uhn.ca INFO [myapp.handler] -
-=[myapp started successfully]=-
16:06:21.685 INFO  [org.projectodd.wunderboss.web.Web] (main) Registered web context /
15-Sep-14 16:06:21 APc47d.4f39.65e6.uhn.ca INFO [myapp.core] - server started on port: 3002

Performance Testing

The app can be stress tested by running the Apache benchmark command:

ab -c 10 -n 1000 http://127.0.0.1:3000/

The memory and CPU usage can be inspected by running either jconsole or jvisualvm and attaching them to a running Luminus server.

Async Ring Handlers

Using async ring handlers is possible but adds another layer of complexity. If things go wrong you'll see a blank screen, possibly without any error message.

The server (undertow, jetty, servlet) and every middleware in the chain has to support async request handling.

To enable: add :async? true to your config maps.

Tested combinations:

Other Templates

There is also a public comparison chart of the common templates.

License

Copyright © 2016 Dmitri Sotnikov

Distributed under the MIT License.