7 ms·
For those with experience, would you say that ClojureScript for frontend stands on its own without a Clojure backend?
by ragnese 6y ago
For those with experience, would you say that ClojureScript for frontend stands on its own without a Clojure backend?
- pizzeriafrida 6y agoAbsolutely, shadow-cljs is all you need, it's not coupled to the Clojure ecosystem, it uses NPM. I'm actually working on a project that uses clojurscript on the backend which is just a `:node` build target in Shadow.
- adamkl 6y agoSame here. I’m slowly writing some wrapper libraries for server side ClojureScript (starting with Express.js). It’s a fun side project for now, but hopefully I can use it to convince some of my JavaScript loving co-workers to give Clojure a try.
- jetti 6y agoIt depends on what kind of project you are using it for. Hobbyist/toy project - sure, using shadow-cljs you can do your front end entirely in ClojureScript and make calls out to whatever backend you want Professional project with ClojureScript backend - sure, you can use shadow-cljs to target both node (using :node target) and the browser which will allow you to utilize ClojureScript for full stack and not have to rely on Clojure Professional Project with non-clojure(script) backend - no. It would not be worth it to spend resources to learn clojurescript (talent pool of existing clojure devs is small) and not taking advantage of full stack clojure(script) can be detrimental
- napsterbr 6y ago> Professional Project with non-clojure(script) backend - no. Allow me to offer a contradicting point of view. On my last project we used Elixir on the backend and Clojurescript (with re-frame) on the frontend. Best decision we've ever took. We were orders of magnitude more productive than we would've been with Javascript. And we were all beginners to Clojure at the time. Re-frame is a beast. Not having to deal with Javascript and its ecosystem is an absolute relief. Once you use Hiccup for the first time, you'll never want to use JSX ever again. So yeah, if it's a new project in my opinion it is worth exploring Clojurescript, even if you don't plan on using Clojure.
- hackeryarn 6y agoSame experience here except with python as the backend. We could not have done half the things we did without ClojureScript on the front end. Also, the learning curve is not very steep if you're just doing a re-frame front ends. You really just need the basic 1/3 of Clojure, and rarely if ever touch all the complex parts.
- ggregoire 6y ago> Best decision we've ever took. We were orders of magnitude more productive than we would've been with Javascript. Would probably have been the same boost in productivity if you had chosen TypeScript though. And choosing TypeScript obviously comes with numerous benefits (large pool of developers, ecosystem, first-class integration in VSCode, backed and highly maintained by Microsoft, etc).
- iLemming 6y ago> Would probably have been the same boost in productivity if you had chosen TypeScript though Nope. It wouldn't. You can replace "Typescript" in your sentence with pretty much any other "-script" thing: Coffescript, ScalaJS, KotlinJS, etc., and it still wouldn't be closer to the truth. The biggest advantage of Clojurescript is out-of-the-box support for interactive development. You are connected to your running application. And without any ceremony, without re-compiling or even saving anything on the disk, you can tweak the program without resetting the state of it. If you have never experienced that first hand, it would feel like it's not a big deal. Alas, it really is. Clojurescript right now (at least for me personally) is the fastest way to prototype anything for the browser. Building things like web-scrapers feels like magic. You just run the program, connect to it and keep experimenting with things until you get the results you want. No other language ecosystem today gives you that liberating feeling. Almost everything else feels too formal and bureaucratic - can't do "this" without "that". It becomes pretty tedious and often removes "the fun" from programming. So, yes, I attest to that - Clojurescript can give you incredible productivity boost.
- peferron 6y ago
- billfruit 6y agoOn a related vein, is cljs viable for PWAs and purely static front end only apps?
- djblue 6y agoI would say so, I have implemented a pwa https://djblue.github.io/portal/ https://djblue.github.io/portal/ hosted via github pages for people to browse through their data-structures. You can also connect the ui to a live host and send it data directly with tap> (kinda like console.log in js).
- sometimesweenie 6y agoI’m a bit biased, but from my personal experience I would definitely say that it does. I’ve worked on two projects that had different backends (PHP and elixir) where the choice to use clojurescript IMO was the correct one. Both projects relied heavily on highly interactive frontends that would’ve been a nightmare to write if I had to use vanilla js. If your backend can spit out json, and your frontend isn’t static, then I’d say cljs should be good to use regardless if the backend is clojure or not. However, the biggest pain point for me was the disappointment of not being able to use clojure everywhere in the stack... so prepare for that if it’s the route you choose.
- erikcw 6y agoI'd say so. I used it for a relatively large front-end (leveraging Reagent) with the backend served by Django Rest Framework. Worked beautifully!
- achikin 6y agoDefinitely so. We use Clojurescript with Python backend and it's great. Clojurescript is very good at json processing/manipulating, so it does not matter what backend you have.