Fork me on GitHub

Fulcro 3.5.19 released. Includes a bugfix for tempid remappings (held in network queues), and a new active-routes helper in dynamic-routing.

❤️ 1

I've never published anything in Clojure before. Could someone please link me to some resources where I can learn about how to deploy a Fulcro app with a backend? If it's in the docs, I think I'm not searching for the right words. Not sure it's entirely Fulcro-specific or not - probably not - but I don't have the awareness to discern that right now, so I thought I'd ask here. For background, I do have experience doing this kind of thing for Python applications.


It's not fulcro specific, but take the rad demo for example: Your server is a standard ring backend. The only thing you'd have to add is a main function to start the server, like so:

(ns my-app.server-main
    [mount.core :as mount]

;; This is a separate file for the uberjar only. We control the server in dev mode from src/dev/user.clj
(defn -main [& _]
  (println "Starting Application...")
  (mount/start-with-args {:config "config/prod.edn"}))
Anything else depends on how you want to deploy it. So if you'd instead like to deploy it as datomic ion You'd do something like this:
(def http-direct-handler
  "Our main HTTP-Direct entry point.
  See: "
    (fn [request]
      (mount/start-with-args {:config "config/prod.edn"})
      (server/middleware request)))))
And expose that function in a datomic-ion config. I don't have any links to share right now. But anything that deploys any kind of clojure app should be useful to you.

Jakub Holý (HolyJak)21:04:42

This also builds the full app, with front and back, into a jar + dependencies jar. If you run the commented-out last line it will put all that into a docker container that you can deploy anywhere, eg


The best mental model I've found is realizing that at the end of it your goal is to launch a jvm process with the proper code (classpath) on some machine (on a local machine, a VPS, in a docker container in a managed system, etc). Studying these docs for clojure.main and playing with examples made a lot of things click for me: When you use clj or clojure command-line tools this is what they're doing: You can make a copy of the clojure shell script on your system and add echo statements to see what it does to gain more insights too So your deploy process becomes answering the questions: • where you want your program to run • how you copy your source code there • how to invoke java there


this means you can use any method to start clojure. Making an uberjar of your project and executing java -cp app.jar clojure.main -m co.myapp.server-entry is one way. You can also install the clojure cli on a server and start your app with a clojure source file: clj -M /srv/app/start.clj


I know this is totally not relevant for a beginner project, but you could run clojure without starting JVM/java by compiling to native too


Thanks for the advice everyone. Hopefully I get it running soon enough. At the moment I'm trying to just follow along with the that @U0522TWDA posted, but when I run: clojure -M:shadow-cli release :main, I get this cryptic exception that I can't figure out the root of... looks like a malformed spec, but I don't know where.


that looks like a defn has some syntax errors someplace:

Caused by: Syntax error macroexpanding clojure.core/defn
this error should show up in a repl as well if that's easier to debug


When I just run the app, I don't get such an error anywhere... it runs as it should..


And linting my src/ directory doesn't show anything obvious either.


could be you need to add another deps.edn alias to that invocation for release clojure -M:shadow-cli release :main -A:dev etc


you can start a clojure repl then invoke the shadow.cli from there, would probably give better errors


not sure if you saw this, but auspicious timing for your question:


No, haven't seen that. Thanks very much for that link too!

Jakub Holý (HolyJak)14:04:04


#object[clojure.spec.alpha$and_spec_impl$reify__655 0x288ca5f0 "clojure.spec.alpha$and_spec_impl$reify__655@288ca5f0"] is not a fn, expected predicate fn
is really weird. I would verify that you have clojure core spec (not the lib but spec for clojure.core itself) and look at the versions of clojure and clojure.spec and this lib. Are they ok?


Ah ha, looks like it's because I didn't include the hyperfiddle/rcf dep. That makes sense, I just wish the trace offered some hint about that. I'll see if running shadow from the REPL gives better output.


No, that's not quite it either. Really strange, I don't understand it, but as long as I have :extra-paths ["src/dev"], and there's an empty (ns user) in there, it builds. Otherwise it gives me that exception about defn. Anyone have an idea about what I could be doing wrong here?

:shadow-cli {:extra-paths ["src/dev" "resources"]
                        {thheller/shadow-cljs {:mvn/version "2.16.12"}
                         binaryage/devtools {:mvn/version "1.0.0"}}
                        :main-opts ["-m" "shadow.cljs.devtools.cli"]},
$ tree src/dev/
└── user.clj

0 directories, 1 file

$ cat src/dev/user.clj
(ns user)
I don't want dev on my classpath at all for release, so I shouldn't need it as an :extra-path.

Jakub Holý (HolyJak)15:04:41

Bad autocorrect. Ask in #clojure


Okay, thanks.


it's expected to need a :dev profile or similar when compiling clojurescript - but you seem to have a different setup. I'm not sure without a repository to look at the details


I fiddled around with it, couldn't figure it out. Got some more help and still couldn't get to the bottom of it. Ultimately ended up deleting my ~/.m2 and after that things just worked :man-shrugging: My config is kinda in a state of transition right now as I work on deployment for the first time, but I'm sure there's some mess in there that I should clean up. I've been putting off getting too deep into the config stuff, but this is a good opportunity to get more familiar and iterate.


oh man, that's rough. I don't have much feedback other than at the higher level of problem solving in general. I only recently read the book Rich Hickey commended here: (how to solve it) and wow! it had such a major impact on how I approach situations like this where you are seeing crazy behavior. it gives you systematic way to go about solving problems that feature unknown information (ie. all problems) perhaps not directly applicable for this situation but likely will help going forward

❤️ 1

Ah, yes... Polya's How to Solve It. I've been meaning to check that out since I saw it mentioned in the back of The Little Schemer. The only thing that's been holding me back is, well, learning other stuff 😛 and my math is a bit rusty, so I don't want to distract too much from programming by brushing up on my math skills. You found the book generally applicable towards solving programming problems? Was it heavy on the math or can you just read through it somewhat casually? Anyhow, I'm making good progress on the deployment effort today. That Metosin article was quite helpful in seeing the big picture. I think I'm just going to deploy without Docker or an Uberjar for now - just using the git checkout method - but will eventually move towards containerizing it. I like the idea of being able to hack directly on my deployment in the initial stages of my project launch, which a deployed artifact wouldn't allow, as far as I understand.


ha yea I had the same problem (I'll get to it eventually - and oh maybe I need to brush up on math first) something made me think of it again recently and I decided to just go for it and read it. It turns out that it only features basic math as the book is intended for a mass audience. the other fascinating thing I learned from it is that "Heuristics" used to be treated as a scientific field - the field of solving problems and it was believed that you could improve upon solving all problems instead of treating them randomly. From the book: "The aim of heuristic is to study the methods and rules of discovery and invention". and goes on to say "The present booklet is an attempt to revive heuristic in a modern and modest form" It is really unfortunate the way language works sometimes when words change meaning and a new word isn't used. It's really difficult to search because of the modern meaning of heuristic, but I did find this: > The German philosopher Gottfried Wilhelm Leibniz (1646–1716) had a similar, though even grander goal in the seventeenth century, namely to develop an algorithm for solving any conceivable problem, using a universal language that would allow every possible problem to be represented. and it's pretty fascinating stuff and a shame that we no longer (in the mass/popular culture) have such high regard for the art and science of problem solving. It's one of the nice things about the clojure community (and its creator) that this sort of meta-reasoning is encouraged just a few more resources 😛 I watched these recently and they touch on some similar concepts, but more directly applied to programming

❤️ 1

@U051V5LLP Alright, you've convinced me.. I'm going to start on How To Solve It 🙂 That is an interesting bit about Heuristics. I guess that in a way, that area of study somewhat paved the way for the machine learning and AI approaches to programming that are gaining popularity today. They're more generalized ways of solving problems, rather than the specialized domain modelling sort of work many programmers are used to. I've seen that Stuart Holloway talk before. It's pretty good. Like many Clojure talks, it's probably a good one to revisit once in a while. I'll check out the other one. I too enjoy Clojure's Hammock Driven development style and approach to problems. Anyway, thanks for the links and stuff. I'm automating my deployment process with Babashka and Spire :thumbsup:

❤️ 1

Nice! Feel free to share any inspiring/enlightening talks/books you come across as well 🙂 For the debugging talk I found his slides to be very helpful in digesting the info: Looking forward to hearing about your automated deployment too!

Mateusz Mazurczak20:04:53

Will there be a support for react version 18?


I don’t see why not. React has generally been good at BW compat.


I don’t see anything in their release announcement that is a deal-breaker

Mateusz Mazurczak07:04:13

There is one thing: Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17.


How do I use vim-fireplace with Fulcro? I can :Connect to the nREPL, but anything I try to evaluate just returnes Fireplace: no default ClojureScript REPL.


hello everybody. I introduce myself. I want to make a mobile app with fulcro and re-frame. My problem is that I want to use the bbdd of a wordpress that I create before. Which is most advisable, I will connect to mysql of wordpress with fulcro-sql (I think that is problematic with mysql) or I will use h2 which can be connected to mysql?? Thanks


what's a bbdd?


I assume from the rest of what you said that bbdd means the mysql instance, right?


yes, sorry I mean database.


What would it mean to have fulcro and re-frame at the same time?


I haven't worked with fulcro-rad so I can't really help you @U412V0LRG, but hopefully someone who has can 🙂

Patrick Brown12:04:16

Personal Experience: At first I wanted to incorporate Re-frame into Fulcro, but I found it’s going a little too far against the grain and my reasons for wanting to do so were very lame. I do think that if subscriptions really fit your project’s domain there can be some value found with Re-frame.


thanks @U036UJBDM5G My point of view is a create a full app with version for web and version for mobile


I think that fulcro could to be the answer

Patrick Brown14:04:31

It can be. It can also be overkill. Where Fulcro excels is in limiting complexity of the complex, but that comes with a learning curve. It’s great fun to learn. It just isn’t the usual web dev paradigm. It also isn’t exactly a ‘Hello World’ use a lein template framework.