Clojure Stack TemplatesClojure Stack Templates

Generate Project

Detailed guide on generating project

Create application

  1. Create project.

    Change myproject to name of you project and run one of two following commands.

    Using Clojure CLI:

    clojure -Ttools install-latest :lib io.github.seancorfield/deps-new :as new && \
    clojure -Sdeps '{:override-deps {org.clojure/clojure {:mvn/version "1.12.0"}}}' \
         -Tnew create :template io.github.abogoyavlensky/clojure-stack-lite :name myproject

    If you already have Clojure CLI with Clojure 1.12.x and deps-new tool, then you can just run:

    clojure -Tnew create :template io.github.abogoyavlensky/clojure-stack-lite :name myproject

    OR alternatively using neil:

    brew install babashka/brew/neil && \
    neil new io.github.abogoyavlensky/clojure-stack-lite myproject

    At the moment neil automatically adds :neil alias to deps.edn after generating the project. So, for now, you might want to delete it manually.

  2. Start development (with mise).

    mise is just convenient tool to manage system deps in version isolation for different projects. If you want, you can install all required tools manually, consult .mise.toml for specific versions.

    cd myproject
    mise trust && mise install
    bb clj-repl
    user=> (reset)

    The server should be available at http://localhost:8000.

Use alias instead of the tool

If you prefer to use deps.edn alias instead of -Tnew tool, you can add a new alias to your global ~/.clojure/deps.edn file:

{:aliases {:new-app {:extra-deps {org.clojure/clojure {:mvn/version "1.12.0"}
                                  io.github.seancorfield/deps-new {:git/tag "v0.8.0"
                                                                   :git/sha "2f96530"}
                                  ; Update this to the latest version
                                  io.github.abogoyavlensky/clojure-stack-lite {:git/tag "0.1.1"
                                                                               :git/sha "95461b6"}}
                     :exec-fn org.corfield.new/create
                     :exec-args {:template io.github.abogoyavlensky/clojure-stack-lite}}}}

Then you can create a new project using the following command:

clojure -X:new-app :name myproject

This approach is also useful if you want to add your own default set of options, for example, you might want to create your projects always with DaisyUI included:

{:aliases {:new-app {;...
                     :exec-args {:template io.github.abogoyavlensky/clojure-stack-lite
                                 :daisyui true}}}}

The same command will include :daisyui option by default:

clojure -X:new-app :name myproject

Options

The template offers customization options for generating your project.

:db

Choose between SQLite or PostgreSQL for your database (Default: :sqlite)

Available values: :sqlite | :postgres

Usage example for PostgreSQL:

clojure -Tnew create :template io.github.abogoyavlensky/clojure-stack-lite :name myproject :db :postgres

For local development the Docker is used to run PostgreSQL database.

:daisyui

Include DaisyUI, a component library for TailwindCSS (Default: false)

Available values: false | true

Usage example for using DaisyUI:

clojure -Tnew create :template io.github.abogoyavlensky/clojure-stack-lite :name myproject :daisyui true

:deploy

Choose between Kamal and no deployment configuration (Default: :kamal)

Available values: :kamal | :none

Usage example for no deployment configuration:

clojure -Tnew create :template io.github.abogoyavlensky/clojure-stack-lite :name myproject :deploy :none

After creating a project

After creating a project you will have a file structure and all configurations for starting development. First thing is recommended to do is checking the code formatting, linting, tests and outdated deps.

bb check

Now we can initiate git and commit initial setup:

git init
git add .
git commit -am 'Initial commit'

Now we can go to Github and create a repository to add it as a remote target to your local one:

git remote add origin git@github.com:myusername/myproject.git

On this page