Optimizing your experience
wikipediawikipedia
Gradient background

Creating a Clojure solution using IntelliJ

Clarice Bouwer

Software Engineering Team Lead and Director of Cloudsure

Wednesday, 17 April 2019 · Estimated 1 minute read

I am creating a simple Clojure web app and API. In this post I explore how to create each with the lein command and what references I need to use.

I plan to work on a monolith IntelliJ and git solution so that I don't need to maintain multiple projects and repositories.

Web App

Copy
lein new re-frame kashikoi-app +less +garden +10x +re-frisk +test +handler +routes
  • CSS +less: less - LESS CSS compiler plugin for Lein.

  • CSS +garden: garden - Generate CSS with Clojure.

  • Debug +re-frisk: re-frisk - A debugging dashboard for re-frame.

  • Debug +10x: re-frame-10x - Visualize re-frame pattern data or reagent ratom data as a tree structure, watch re-frame events and export state in the debugger.

  • Development +test: clj.test - A unit testing framework and doo - A library and lein plugin to run cljs.test on different js environments.

  • Full-stack +handler: compojure - A consice routing library for Ring/Clojure.

  • Routing +routes: secretary - A client-side router for ClojureScript.

API

Copy
lein new app kashikoi-api

Follow the instructions to create an API using Compojure (web APIs, includes Swagger) and Toucan (define application models and retrieve them from a database).

IntelliJ

Create a monolith solution by adding both projects to the solution. This is useful if you want to maintain a single repository instead of two.

  • Create a blank project
  • Import each module using the Leiningen external module option
  • Set resources, sources and test directories
  • git init on solution
  • Commit your files as desired

To access the modules dialog box again > Right-click on a project, click on Open Module Settings or File > Project Structure or Ctrl + Alt + Shift + S

References