This episode is for subscribers only. Sign Up or Log in to watch it.

2. Introduction to Luminus, part 1

Published 14 May 16

To give you a starting point for building your own app, we’ll go through the process of building an application from scratch with Luminus. In this first part in a series of three, you’ll learn to set up the database, write migrations to create tables with Migratus, create SQL queries with HugSQL, and tie it all together with Compojure routes and Selmer templates.

Show notes

One of the challenges when starting out with Clojure is piecing together a web development stack. There is no single dominant framework like Rails in the Ruby world, or Django for Python. Instead the focus is on small composable libraries. Figuring out which ones you need, what they do, and how to put them together can be a real challenge.

The Luminus project seeks to remedy this. It gives you everything you need to get started in a single package. Luminus comes with comprehensive documentation, including information on security, testing, and how to deploy your app to production.

In this episode, and the next one, I’ll take you on a quick tour through Luminus by building a simple wiki application.

lein new luminus lambwiki +postgres

Luminus comes as a template for leiningen, so I’m generating my application skeleton with the lein new command. I’ll be using PostgreSQL to store the data. It’s a tried and trusted database that I’m confident to use both during development and in production.

cd lambwiki
l
env
log
resources
src
target
test
Procfile
profiles.clj
project.clj
README.md

The directory layout is pretty standard. Most code lives under the src directory. Configuration that only relates to a specific environment, such as development, or production, goes under env. The resources directory contains everything that isn’t clojure code, like SQL queries, HTML templates, CSS, and Javascript.

browse source code

!!WARNING!! High pacing

The pace of this video is very high. Pause often, keep the transcript handy, and refer to the code on GitHub if necessary.

This is less of an issue in following videos, and should no longer be an issue starting episode 10. I’ll redo these Luminus episodes at some point. Until then either skip to the later episodes or try to make the best of it.

Docs

The Luminus docs should be your first port of call, they have information on all the main pieces of your application.

Migrations are powered by Migratus, and database queries by HugSQL. Check their respective project pages if you want the full low-down.