Can I compile two programs with one shadow-cljs configuration?

Say I have two JavaScript programs, one runs in a browser, the other runs in Node.js. The code are all in src/ folder with two different entries: src/app/client.cljs and src/app/server.cljs.

Can I start a shadow-cljs server to compile both of them?

Currently I’m using two folders like client/src/app/ and client/src/server/ with two seperated shadow-cljs servers compiling them. I want to reduce the cost building programs meanwhile share code between two of them.

Of course you can. Just create 2 builds? shadow-cljs watch client server to start both from the CLI.

Or do it from the REPL.

$ shadow-cljs clj-repl
(shadow/watch :client)
(shadow/watch :server)

Good example for an entire project here:


I find shadow-cljs one of the most intuitive pieces of software i have ever encountered … congrats on the design. :grinning:


Didn’t know watch accepts multiple arguments. Cool.

One more question, does watching server differentiate two programs seperately? Like after editing client.cljs, will the server part be notified of reloading?

No. One watch does not affect the other. The only thing that matters is what is used in a build. So if you edit app/client.cljs the server won’t be affected. When you edit app/shared.cljs it will be when the server actually uses it.

1 Like

Works as expected after refactoring my workflow by merging two of them into a single project.

Now shadow-cljs is compiling(and maybe reloading) my front-end and back-end code in the meanwhile. Would reduce some tedious works.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.