Skip to content

Getting Started with Axiom

Boaz Rosenan edited this page Aug 27, 2017 · 11 revisions

This tutorial walks you through the steps of creating a new project and running it on a development machine.

Prerequisites

Before you can create a new project and run it, you'll need the following installed on your machine:

  • Docker and Docker-Compose, which ship together for Mac and Windows (for Linux you'll need to install Docker and then download the Compose binary).
  • Java 8
  • Leiningen 2.7.1 and up.

Creating a Project

The easiest way to start an Axiom project is using our Leiningen template:

$ lein new axiom-cli your-project
Generating fresh 'lein new' axiom-clj project.

This will create a new project name you-project, which will have the following structure:

$ cd your-project
$ find . -type d
./.gitignore
./axiom.log
./CHANGELOG.md
./doc/intro.md
./docker-compose.yml
./LICENSE
./project.clj
./README.md
./resources/public/index.html
./resources/public/tests.html
./src/your_project/core.clj
./src/your_project/core.cljs
./test/runners/browser.cljs
./test/runners/doo.cljs
./test/runners/tests.cljs
./test/your_project/core_test.clj
./test/your_project/core_test.cljs

This project already contains a small todo application, which you can read play around with before removing it and writing your own.

Running Required Services

Axiom needs DynamoDB, RabbitMQ and Zookeeper to work. Fortunately, you do not need to install them individually.

The project you created contains a docker-compose.yml file, which contains the specifications for three Docker containers, one for each service (DynamoDB, which is a hosted AWS service is replaced with aws-dynamodb-local, which server software provided by Amazon for developing software that uses DynamoDB outside the AWS environment).

To launch the services, run:

$ docker-compose up -d

On the first time you run this, Docker will download images for the three containers. Depending on your network connection this may take a short while. Once it's done, it will launch the three containers and exit.

Launching Axiom

Now you're all set to run Axiom. From within the root of your project, type:

$ lein axiom run

This will start Axiom itself.

On another shell, type:

$ lein figwheel

This will launch Figwheel, which will allow you to modify the client-side code and see the changes live.

Now, go to http://localhost:3449/index.html?#?_identity=foo. You are supposed to see a button with the caption "New Task".

Clone this wiki locally