mazeru

2 min read Original article ↗

A mix-up of various technologies and frameworks to create a full-stack server-state framework

"mazeru" means to "mix up" in japanes wikipedia

Overview

mazeru architecture:

architecture

Prerequisites

  • deno
  • bb

Todos

  • bun and node support

Testing

Don't install playwright the normal way (with npm install and npx playwright install). This will conflict with the nix flake. Instead of running npx playwright, just run playwright, the binary is imported by the flake.nix

Update

Update nix with nix flake update

Snippets

deno run tests #run tests
deno run server # start the server (and repl server) 

watching files

ls src/mazeru/* | entr -r deno run server

start nrepl

clojure -T:nrebel :port 1337
#or
bb server-repl

Settings for rebel

If you prefer enter to execute the command in rebel, add this to ~/.clojure/rebel_readline.edn:

{:key-map :viins
 :key-bindings {:viins [["^M" :clojure-force-accept-line
                         "^J" :clojure-force-accept-line]]}}

repl commands

You need to be in xan other namespace (maybe even in user) than the one your reloading for this to work

 user=> (require '[mazeru.frontend :as frontend] :reload) (require '[mazeru.server :as server] :reload) (require '[mazeru.stream :as stream] :reload)

Send hiccup to frontend

(stream/transfer (server/get-last-session) "elem4" [:div "hello"]
)

Send hiccup with datastar binding

 (stream/transfer (server/get-last-session) "elem4" [:div {:data-text "$thetext"} ""]
)

Send signal

 (stream/send-signal (server/get-last-session) #js{:thetext "hello
again"}) 

slides

  deno init --npm slidev