The Caribou directory structure is designed to be simple and flexible.
Running tree
in the root illuminates the structure:
├── app │ └── assets ├── project.clj ├── resources │ ├── cljs │ │ └── taiga.cljs │ ├── config │ │ ├── development.clj │ │ ├── production.clj │ │ ├── staging.clj │ │ └── test.clj │ ├── public │ │ ├── css │ │ │ └── taiga.css │ │ ├── favicon.ico │ │ └── js │ │ └── taiga.js │ └── templates │ ├── errors │ │ ├── 404.html │ │ └── 500.html │ └── home.html ├── src │ └── taiga │ ├── boot.clj │ ├── controllers │ │ └── home.clj │ ├── core.clj │ ├── helpers.clj │ ├── hooks │ │ └── model.clj │ ├── migrations │ │ ├── admin.clj │ │ ├── default.clj │ │ └── order.clj │ └── routes.clj ├── taiga_development.h2.db
There are some main features to take note of for now.
First is the project.clj
, which configures lein
and holds information about dependencies and plugins. You will be editing this when you want to add a new Clojure library to your project, for instance. Also, this is where you define various options about how the site runs, including the port, the handler and an init function that is run on boot. Full details can be found in the configuration section on project.clj.
The resources
directory has four branches: cljs
, config
, public
, and templates
.
config
holds all the configuration files for the various environments that your Caribou app will eventually run in. The name of each environment maps to a configuration file with the same name and suffixed by .clj
. So in the "development" environment Caribou will use the development.clj
config file. For now the app defaults to development
, but there are things you will want to shut down for production that are helpful in development, like automatic code reloading. For this Caribou provides a production.clj
with its own set of configuration options.public
will be accessible as a static resource under the URL that maps to this directory structure. If all you have is static content, just throw a bunch of files in here where you want them to be accessed and you are good to go! We have put some helpful files in here to get you started, (css and js) but nothing is set in stone. Have at!src
holds all of the Clojure files that run your Caribou site. Inside is a directory named after your project (here that is "taiga"). All of your site specific code will go in here.
There are some notable entries in your project source folder:
order.clj
. This is necessary so that the migration system knows what order to run the migrations in. The database keeps track of which migrations have been run, so no migration is ever run twice on one database.This will be named after your project with the suffix "_development.h2.db". By default Caribou uses H2 because it is an all java database which requires no native dependencies. You will probably want to swap this out with your own database backend, but Caribou will work fine if all you ever want to use is H2.