Fork me on GitHub

Hey y’all. 🙂 Quick non-scientific poll question: I’m starting a new ClojureScript project with Om Next, and haven’t really been able to find any new blog posts, Reddit threads or tweets on the best Clojure server-side framework for React/React-Native CLJS apps as of late 2016. I did see both the Om Next demo, CircleCi’s frontend and the Precursor app now open-sourced all use Ring. But I’m not sure if there’s a general consensus now given all the activity in the community as of late, if one were to start a new Om Next project from scratch, what the simplest (in Rich Hickey/David Nolen terms) framework of choice is now. Pedestal has the backing of Cognitect, Arachne is almost ready for alpha, and new things like Duct and Luminus have popped up, etc. Thoughts on if Ring is still the way to go? Would seriously appreciate any input for a newbie. 🙂 Thanks in advance!


@keatondunsford it is really tough to answer to these kind of questions, there is a mix of things in it. Probably the first thing to understand for you would be if you want to go for a pre-packaged solution or not. By pre-packaged I mean luminus or pedestal mainly, which are super battle tested. The other option is to just adding libs to a bare-bone project, which might be scary but for sure more rewarding in terms of understanding what the moving parts are. Additionally, if you are going for a REST app, ring can be a good choice if you want to take the super safe way. An alternative to the ring architecture is yada. I am sure I am forgetting many other alternatives actually but these are the ones I went for in the last two years+ of my Clojurism 🙂 Last piece of advice I can give is to ask as well to #beginners.


I’ll totally do that. 🙂 My intuition is to trust whatever Cognitect is backing. Counterargument I guess would be to use whatever is the most composable, which sounds like it’s Ring. Kind of like the Boot > Leiningen argument for long-term projects.


@keatondunsford right, that's a good analogy 😄 It also depends on what is the scope of your app and many other things, I kept my answer very short 😉


Haha yeah for sure. 🙂 If this project does go well, which is the intention, I am hoping to scale it and take it on as a startup. The high-level concept I’m working on is to essentially build “Reddit meets Snapchat stories and Tinder” for creating project-based communities around video tutorials on any subject (like building flying cars, or making rap beats, or a new VR video game), and then try and connect people physically who are near each other’s locations and want to make the same cool things together in person. So architecture wise, I’ve been looking into separating a lot of the different backend pieces via microservices in Dockerized containers all connected by RESTful APIs. Which it sounds like Pedestal is sort of designed for out-of-the-box.


I have not used pedestal yet in a project so I can't comment on that. Just one thing I would suggest, as Rich said, not everything is I'd evaluate very very deeply how it has been designed before a buy-in. Of course, if it matches your requirements above, then it is the right choice for you 😉


Sounds good. 🙂 Thanks so much for the help!


you're welcome! 🙂


Hi guys; I would be glad to know if there is a non interop method to load css or js resourses ?


is it possible to eval cljs from js?


@thedavidmeister I'm not sure we can. I've used only "^:export" though.


mmm that’s cool


i just wanted to be able to run some cljs with selenium >.<


@thedavidmeister ya it would be redundant to use klipse plugin. I wonder you could use selenium cljs plugins to do that. It's just a suggestion infact I haven't done that.


not sure, i know that i can execute js


i wondered if i could do something like (execute-script “cljs.core.eval(‘(prn 1)’)”)


but that doesn’t work


@thedavidmeister: there is no cljs.core.eval, think about this: macros in ClojureScript are written in Clojure, so you need JVM+Clojure to translate arbitrary ClojureScript snippets to Javascript code snippets. You could use Bootstrapped ClojureScript, but as you pointed out, this might be an overkill. Why don’t you compile the code snippets you want to run the usual way via leiningen or boot and then execute them in selenium as Javascript?


@darwin i’m trying to test some code i wrote that relies on the js/window object, do you think this is a good way to approach that?


@thedavidmeister I’m sorry, I don’t understand your question. What is “this way”? And how is code which relies on js/window different from any other code from the testing point of view?


@darwin well, normally when i test some clj or cljs i can pass data to the functions i’m testing and see what comes back


but js/window comes from the browser the js runs in


so not sure how to “get at” it


I assume you are using something like phantomjs or selenium. Your tests written in cljs are compiled into Javascript. And you are executing that Javascript code when running phantom/selenium. Nothing is preventing you writing cljs code working with js/window, because resulting generated Javascript will run in an environment where js/window is available.


Or am I missing something?


tests are written in clj


aha, so you are using clj-webdriver to automate chrome, that is a different story


actually it’s just a bit slow and tests can be flaky


so i wanted to start looking at alternatives, for at least some of the tests i wrote this way


you have to use clj-webdriver’s api to query browser state, I’m not aware of any way how to inspect js/window properties without writing Javascript, which would be sent to chrome instance (e.g. via clj-webdriver)


was looking at execute-script


which led to me needing to write js, which led to me asking if i could eval cljs from js...


as I wrote above, you could write a separate cljs project, which will compile your cljs to js, and then you can execute that js


for inspiration, here is my phantomjs setup: a) I have a separate cljsbuild for tests project[1] b) I use cljs.test to write my tests (compiles to Javascript), record test failures here [2] c) use this minimal phantom.js boilerplate [3] [1] [2] [3]


If you wanted to stay using clj-webdriver, you could do something what I did in dirac. You could automate chrome via clj-webdriver to open a page with your tests (again those tests must be in cljs) and then somehow check results via clj-webdriver, it could be as simple as a flag with result code, or something fancy like sending some kind of transcript back and comparing it to expected results: (for inspiration)


@darwin thanks 🙂 lots for me to look at


@darwin i’m not wedded to clj-webdriver, it just seemed like a straightforward way to get up and running for testing my app


think about your clj code (clj-webdriver) just as “glue code” for automating chrome, not as real tests, real tests must be written in cljs and compiled to javascript


what do you mean by “real tests”?


real test for example goes and checks if js/window has expected properties you added to it, you cannot do this from clj-webdriver without writing javascript


clj-webdriver allows you to check if DOM has some selector present, or retrieve content of the page, you can do some testing this way, but it is not matching full power of javascript running inside the page


oh right, as in, tests that aren’t treating the cljs being run as a “black box"


@darwin well, i guess it’s time for me to look at upgrading my test suite then 😉


i am starting to hit walls with what i have atm


if you don’t need latest chrome features, I would pick phantomjs, it is easier than selenium (and head-less)


if i’m just testing individual components of the app, which i will be able to, i don’t think i need chrome


@thedavidmeister you might want to look at lein-doo to run front-end unit tests (


thanks, i’m using boot-cljs-test atm for unit tests


and for integration test, I use a fixture that compiles our app using together with clj-webdriver


(if that doesn’t help at least maybe I get feedback on our own setup :p)


i’m not having any troubles building my app and running clj-webdriver against it with boot 🙂


oh then sorry misunderstood the question :s


the thing i’m not doing is running my tests alongside the code run in the browser then exporting the results of the tests back to boot


so i have the same access to the code that i have when running the unit tests, but i’m interacting with the code within the browser @jell


In production I'm using :optimizations :advanced and in one of my cljs files I'm using .getBrowserEvent on an instance of I've added to :import in my namespace definition, but .getBrowserEvent is still referred by its full name, whereas in goog libraries it's being minificated. Is there anything I can do to force this minification on .getBrowserEvent?


@p-himik: aren't you referring to getBrowserEvent by string name?


Nope, regular dot operator.


another theory: there could be an extern covering getBrowserEvent, but that should cause goog libraries to behave the same as your own code, I think


Indeed it should, as far as I understand the externs.


A piece of code that I use:

(fn [evt]
  (prevent-default evt)
  (stop-propagation evt)
  (h (oget (.getBrowserEvent (raw-event evt)) :dataTransfer))
  ;(h (-> evt raw-event .getBrowserEvent (oget :dataTransfer)))
neither of the two last lines work - both calls to .getBrowserEvent are not minificated.


Oh wow, please disregard all that. My stupidity doesn't know its limits.