This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-04
Channels
- # announcements (5)
- # aws (11)
- # babashka (15)
- # beginners (101)
- # biff (14)
- # calva (45)
- # clj-kondo (18)
- # cljs-dev (5)
- # clojure (178)
- # clojure-austin (5)
- # clojure-europe (8)
- # clojure-france (1)
- # clojure-nl (12)
- # clojure-norway (6)
- # clojure-spec (4)
- # clojure-uk (1)
- # clojurescript (13)
- # community-development (2)
- # conjure (6)
- # cursive (8)
- # datahike (1)
- # datalevin (3)
- # datascript (36)
- # datomic (6)
- # emacs (2)
- # etaoin (2)
- # fulcro (5)
- # graalvm (6)
- # gratitude (3)
- # introduce-yourself (1)
- # jobs-discuss (1)
- # lsp (19)
- # malli (4)
- # nbb (11)
- # off-topic (4)
- # other-languages (1)
- # pathom (19)
- # pedestal (1)
- # shadow-cljs (22)
- # spacemacs (16)
- # tools-deps (31)
- # vim (7)
Where can one find the value for db to supply to
(biff/q db
'{:find email
:where [[user :user/email email]]})
for repl based xtdb interaction? Is it in @com.biffweb/system? I’m trying to interact with the database from the repl in a running app, but I may be off base in my approach.you're thinking about it the right way. take a look at get-sys
in the repl.clj file.
the XT node is stored at (:biff.xtdb/node @com.biffweb/system)
so you can pass that to (xtdb.api/db node)
to get the db. There's a helper fn com.biffweb/assoc-db
which will take your system map and then assoc a db value onto :biff/db
so i.e. I do repl interaction like this:
(defn get-sys []
(biff/assoc-db @biff/system))
(comment
(let [{:keys [biff/db] :as sys} (get-sys)]
(q db
'{...})))
(by evaluating the let
form)Aha… I was getting the node from @com.biffweb/system
and trying to use that as the db; I was missing a step.
Nice! Worked. All set now.👍
New lisper here. For a solo dev trying to choose between fulcro and biff. Any advice you’d offer to them to help make the right choice?
In a nutshell I'd say Biff is better for small projects and Fulcro is better for large projects. Biff is pretty lightweight. It mostly just ties together a bunch of libraries for you. Fulcro on the other hand has its own set of abstractions you need to learn in order to become productive with it. I tried using Fulcro for 6 weeks at the end of 2019 and never really figured it out, despite hours of reading the docs and source code. That was part of the impetus for making Biff a few months later--I wanted something optimized for the solo dev use-case. So for your case, if you're mainly interested in just getting productive quickly, I'd recommend Biff. But if you're interested in expanding your horizons and don't mind spending more time in the learning phase, then Fulcro could be good.
If you haven't already seen it, https://kit-clj.github.io/ is another good contender. It's relatively new but it's the successor to https://luminusweb.com/ which has been around for a long time. I haven't used Kit (or Luminus) but my understanding is that it tries to be more modular than Biff. Kit provides tools for mixing and matching different libraries whereas Biff basically says "here, just use X, Y and Z" (although if you do end up wanting to do things a different way, Biff is designed so you can take it apart without too much trouble). I'd still recommend Biff myself, but of course I'm biased 😉
also for context on this: > Biff is better for small projects The https://thesample.ai/ I've built with Biff is about 20k lines of code, so I'm confident in saying Biff can handle a project of at least that size.
I see. What do you think of perfomance of biff? Also, if am also interested in learning ins and outs of web dev, is biff still a good choice?
Performance should be fine. It'll mainly depend on the libraries Biff uses, all of which are battle-tested (e.g. https://www.eclipse.org/jetty/, https://github.com/metosin/reitit, and https://xtdb.com/). If you get to a point where you need to make it go faster, then you can start switching things out. I think there are other web servers faster than Jetty for instance. If you're planning to build something particularly intensive, it wouldn't hurt to become familiar with XTDB and make sure it fits your needs (there's an #xtdb channel too fyi). > Also, if am also interested in learning ins and outs of web dev, is biff still a good choice? Yep! After you have something working, you can start reading through Biff's source code to learn how it pieces things together. That'll help you learn about the underlying libraries. To get started reading the source code, you'd want to first make sure you understand the https://biffweb.com/docs/#system-composition section in the docs. Then you can pick any of the component functions and start reading the source from there. For example, https://github.com/jacobobryant/biff/blob/master/example/src/com/example.clj#L78 to see the list of components in your app, and then look for the source https://github.com/jacobobryant/biff/blob/master/src/com/biffweb.clj#L39. (I'm planning to write a bunch of tutorials/a small book that'll take readers through that process, but it won't be finished any time soon)
also, the entire source--not including the application template, which is copied into your project--is only 1.5k lines, so it shouldn't take terribly long to read.
The main thing you won't learn from Biff is ClojureScript. It's pretty common for Clojure web apps to use CLJS for the frontend with a react wrapper like https://reagent-project.github.io/, and often https://github.com/day8/re-frame. Biff omits all of that intentionally in an attempt to keep things simpler, with https://htmx.org/ basically as a stopgap solution. imo you can go pretty far with that, but if you know you want to use CLJS/React (e.g. if you're building something highly interactive, akin to google docs), Kit would probably be better than Biff since I'm pretty sure it includes some template code for CLJS.