/clojexcms

Clojure(Script) Example CMS

Primary LanguageCSSEclipse Public License 1.0EPL-1.0

clojexcms – Clojure(Script) Example CMS

Developed for the :clojureD conference 2015, "Web Applications by Example", Steffen Beyer. Slides for the talk are here.

Use this project as an example or as template for your own developments.

frontend is the visitor-facing website, backend is the administration panel.

backend screenshot

Architecture

(in terms of libraries and building blocks)

architecture

  • Light Table – Live-coding environment
  • Chestnut – Application template for ClojureScript/Om with live reloading
  • Figwheel – Leiningen plugin that pushes ClojureScript code changes to the client
  • http-kit – HTTP client/server for Clojure
  • PostgreSQL – RDBMS
  • Flyway – Database migrations
  • Yesql – Simple SQL adapter
  • Sente – Bidirectional messaging via WebSockets/AJAX
  • Om – ClojureScript interface to Facebook's React
  • Bootstrap – HTML, CSS, and JS framework

Setup

Create a PostgreSQL database and put the config into project.clj and src/clj/clojexcms/database.clj (see #1).

Seed the database by running

lein flyway migrate

Light Table Development

Add the folder to your workspace and open src/clj/clojexcms/server.clj. Evaluate the file, then evaluate the (run) expression at the bottom.

The call to (run) does two things, it starts the webserver at port 10555, and also the Figwheel server which takes care of live reloading ClojureScript code and CSS.

View the server starting up in the console.

When you see the line Successfully compiled "resources/public/js/backend/app.js" in 21.36 seconds., you're ready to go. Browse to http://localhost:10555 and enjoy.

To shut down the server, open the connections panel and disconnect from clojexcms.

External Browser Connection

If you want to connect an external browser to Light Table, you need to find out the current port, which changes with each start of Light Table. Open the connections panel, select Browser (External) and insert the displayed port number into env/dev/clj/clojexcms/dev.clj. Reevaluate the function or restart the server.

Server Startup via REPL

Open a terminal and type lein repl to start a Clojure REPL (interactive prompt).

In the REPL, type

(run)

Further References

Skins

License

Distributed under the Eclipse Public License version 1.0.