You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wanijo/README.md

2.1 KiB

Wanijo

(Toki Pona) Wan: One, a, unite, make one Ijo: thing, something, object Wanijo: Unite things

How to develop

You'll need:

  • JDK >= 8
  • Leiningen >= 2.9

First time launch with fresh a database

  • start a neo4j database with lein neo4j
  • start a repl with lein repl or similar
  • import wanijo.infrastructure.repl
    • if you use leiningen for launching the repl, this will be your init-ns
  • run wanijo.infrastructure.repl/create-user! using the desired username and password as parameters
  • run wanijo.infrastructure.repl/run-migrations! to create desireable database constraints and structures

Launch the application server

  • start a repl
  • import wanijo.main
  • run wanijo.main/start-server-dev!
    • the application is available on port 8080

Launch as a standalone

  • build the uberjar via lein uberjar
  • start your neo4j database, preferably not via lein neo4j
  • start the jar file via java -jar [jar-file]-standalone.jar
  • if this is the first start with a fresh database, connect to the nREPL as described in the chapter "nREPL" and run the commands described in "First time launch with a fresh database"

nREPL

When started via its main method, as is the uberjar case, an nREPL server is started with it. The default port is 7888, but this can be configured via the NREPL_PORT environment variable.

To connect via the command line, use the following command:

clj -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.7.0"}}}' -m nrepl.cmdline --connect --host host --port port

"Architecture"

Structure your application as it seems to fit your needs. Then call it architecture and pat yourself on the shoulder. You've achieved something!

The first level of structure are the building blocks of the domain, e.g. instance, schema. Inside these namespaces you'll find namespaces for each technical need: routing, database access, domain rules etc.

wanijo.handler collects all routes and passes them to ring.

wanijo.infrastructure contains the namespaces needed for technical code that do not belong to any domain, like database access, routing or similars.