MVC web application skeleton, written in Clojure with user management and nice theme.
Language: Clojure
Web framework: Compojure
Javascript: JQuery
Graphing: Flot
Layout: Bootstrap
Database: PostgreSQL, via Korma
- CD to wherever you keep your projects
cd ~/dev/clojure-projects
- Download init script
curl https://raw.githubusercontent.com/anonymoose/clojure-skeleton/master/init > init
chmod +x init
-
Name your project. We'll call it "fish" for now.
-
Run the script
./init fish
- Start up a browser to http://localhost:5000
You ran a script blind off the internet, didn't you. Don't do that. All it did was:
-
Cloned everything for this project from git.
-
Renamed the directory and all references to "myproject" to your project name.
-
Created a database and set up security settings only suitable for a dev environment. If you run with your password the same as your project name in production, you are an idiot.
-
Creates a bin/.password file to hold your passwords so scripts work locally.
-
Removes clojure-skeleton's git directory and initializes a git repo.
-
Initial commit
-
Starts up the app on http://localhost:5000
- You're not done, but this may have saved you a week.
- [https://devcenter.heroku.com/articles/clojure-web-application](Good article on putting clojure apps on Heroku)
- Entry point - src/$yourproject$/core.clj
- Controllers - src/$yourproject$/controller
- Model - src/$yourproject$/model
- Routing - src/$yourproject$/controller/routes.clj
- DB schema - doc/schema.sql
- CD to your project root
- Execute dev script:
> bin/dev
main INFO log.MLog - MLog clients using log4j logging.
2014-03-19 16:19:00.494:INFO:oejs.Server:jetty-7.6.8.v20121106
2014-03-19 16:19:00.529:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:5000
Started server on port 5000
- Make changes to your files. They are automatically reloaded via Ring's "auto-reload?" param in project.clj. It's not perfect, but its pretty close.
- Fire up "lein repl" or other mechanism in Emacs or whatever.
04:32 PM|kb|~/dev/clojuredev/clojure-skeleton> lein repl
myproject.core=> (load-file "doc/repl.clj")
"ready."
myproject.core=> (re)
"ready."
myproject.core=>
- When you make a change in your files, just run "(re)" to reload everything.
- Read the contents of doc/repl.clj and add to taste as your project progresses.
I am lucky enough to have Mac. If I get time I'll extend this to Windows. Now fielding pull requests...
- resources/templates/*.html
- Templates use Selmer. It's pretty great if you like to get done and on with your life. If you like to fight with things go use Enlive or something else. I'm not smart enough.
- http://startbootstrap.com/sb-admin
- Change it up. This is a starting point. If I see 200 of these out on the web with no modification I'm going to be pissed.
- Make changes in doc/schema.sql
- bin/reset-schema
Copyright © 2014 Palm Valley Software
Distributed under the Eclipse Public License, the same as Clojure.