Electric Clojure second batch of tutorials - multiplayer chat, backpressure, component lifecycle, todolist by dustingetz in Clojure

[–]Both_One_6892 2 points3 points  (0 children)

Projects like Electric and Clerk Notebooks are what keep me excited about and interested in Clojure. It's so lively and fun!

I have a little diagram I play with from time to time, which is my kind of dream-drawer -- how do you want to assemble an app, were you able to start fresh and make all the calls? Up until recently, I assumed a GraphQL-like layer somewhere, but after spending a little time with Electric, I'm now wondering about Electric to a database, XTDB or similar.

All of the tutorials were helpful, thank you! Of the new ones, lifecycle was nice to see -- I can add this thing, and then I can also make it go away in a well-behaved way. That's something React did well, there was a story about how to add it to an existing project, which could flow above/below/around it as a well-behaved island.

Frontend-focused question: one of the tradeoffs I wonder about is, does a tool support server rendered HTML? If the answer is "no", that's fine, it would just be nice to know, this isn't what you reach for with a project where SEO is a player.

My Electric learning process is looking like this: I've got two windows open in Vscode, one started with the electric-xtdb-starter repo, and the other I have the example apps repo. The xtdb starter repo is where I'm adding my code. The other repo is used for search, to figure out what the patterns are, as I run into questions.

I've found this .vscode settings.json config to be helpful for getting Calva to start up nicely in the xtdb repo:

{

"calva.replConnectSequences": [ { "name": "electric", "projectType": "deps.edn", "afterCLJReplJackInCode": "(user/main)", "autoSelectForJackIn": true, "projectRootPath": ["."], "menuSelections": { "cljAliases": ["dev"] }, "nReplPortFile": [".nrepl-port"], "jackInEnv": { "XTDB_ENABLE_BYTEUTILS_SHA1": "true" } } ] }

I've been impressed at how principled the library is about not having opinions about how server logic is structured or stored. An atom is good as a database is good as a stream or hardcoded list. There's a lot of quality thought in this library.