Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.53 KB

DEV.md

File metadata and controls

53 lines (37 loc) · 1.53 KB

Development

For the file and folder layout, see CODE_ORGANIZATION.md.

Stack

  • Backend: Clojure, datascript (in memory, dumped to data/datascript.nippy every 60 s) (datomic-like graph db)
  • Frontend: ClojureScript, reagent
  • omni — SPA framework wiring stuff together
  • tada — declarative queries and commands for the abstract 'system'

Getting started

Install java and clojure, then clone the repo.

Create a config.edn at the repo root (gitignored):

{:http-port 9365
 :environment :dev
 :website-base-url "http://localhost:9365"
 :auth-cookie-secret "0123456789123456"
 :auth-token-secret "0123456789123456"}
lein repl
(start!)      ;; from georgetown.core; boots omni (http server + cljs build)

georgetown.dev.seed/seed! (or seed-plus!) populates a fresh db with an island.

Tests

Tests use hyperfiddle.rcf , inline with the functions they test.

Build

lein uberjar

The core loop

  1. server/scheduler.clj ticks each island once per second (chime).
  2. On any transaction, db/watchers fire and push/on-db-change! recomputes the per island, user and player state, then sends diffs to the connected clients.
  3. The client long-polls GET /api/state (push/handler) and mirrors the result into the atoms in client/state.cljs.
  4. User actions call state/exec!, which POSTs to /api/command; routes/dispatch-event! runs the matching tada command.