Can I write frontend (reagent) and backend (express.js) applications in a same clojurescript project?
Following these two pages.
Writing Node.js applications in Clojure and using NPM packages Backend (express.js)
shadow-cljs Frontend (reagent, react)
Both of them are similar, create a new cljs project with npx create-cljs-project {project-name}. However, these are two individual projects, can I write frontend and backend application in a same project, if it is possible, how to manage repl in this project?
Sure, the entire system is designed to combine as many things as you like. Just configure multiple builds in the
shadow-cljs.edn:buildsmap.If you already have both separate projects just take the .cljs files and move them to the other. Then take the build config and also move it into the other
shadow-cljs.edn.You may either control multiple builds from the shadow-cljs UI or the command line. All build relevant commands allow you to specify multiple builds (eg.
npx shadow-cljs watch backend frontend, with the:frontendand:backendbuilds inshadow-cljs.edn).You can use namespaces to properly "categorize" your project. I generally have something like
my.app.uiormy.app.frontendfor frontend related things and something likemy.app.serverormy.app.backend.With the
watchfor both builds running you can just switch between the REPLs in your editor. From the command line you can justnpx shadow-cljs cljs-repl frontendornpx shadow-cljs cljs-repl backend. Or switch between them from a Clojure REPL vianpx shadow-cljs clj-repland then(shadow/repl :frontend). That'll bring you into the CLJS REPL for the:frontendbuild. You may exit that via:cljs/quit, which brings you back to the CLJ REPL.