Fork me on GitHub

hi, I'm new to clojure from Java and I would like to know how to embed nrepl in a production java app and what gui tools can I use to connect to it. what options are there for security (authentication) ?


the default transports are all socket based. What people typically do is to allow connection from local only, without security, then reply on SSH to provide security


there is, which gives access over https. don't think there's any built in security, but you are free to add your own there.


in term of GUI tools, the best bet are the ones built into the major clojure dev tools, e.g. Cursive for IntelliJ or Calva for VSCode


I'm sure standalone tools exist, but that's not a common way to use nREPL, so doubt they are too well developed


ditto for brower based clients


not all of them are in active development, and some are very dead though


but compatibility should still be good


thanks, it's very helpful


I did manage to do what I was aiming for


I've gone with basic socket based nRepl


it can be started / stopped at will


authentication is an issue - since there are no OOTB options out there


I think drawbridh over websocket + Oauth2 / OpenID connect would be nice at some point


I'm working on adopting clojure inside some projects and this is something that I would like to experiment with: • make the application start with nrepl • expose some 'context' that I can use to interact with the application runtime - like a spring application context


ideally this should be usable from the browser but connecting from ide would be ok too.


for whom it might concern: just found which is a nice start, please share how you use it


also found , is there a browser IDE for clojure /nrepl?

Lennart Buit20:05:04

Hai. I have a bit of a question, I have this nrepl server, and I like to configure which ns you ‘drop into’ when you connect to it. Ala :init-ns in a leiningen project. Now I found which is deprecated and suggests that you can configure this in nREPL. However, I can’t find out how 😞, can someone shine a bit of a light on that for me ^^?


Feel free to submit a ticket for nREPL to add a command-line flag for this. I never needed it, so it didn’t cross my mind, but it’s easy to do.


It’s just a matter of setting *ns* for the initial nREPL session manually.

Lennart Buit08:05:44

I’ll create an issue somewhere today ^^, thanks


what client are you using to connect to nREPL?


this feels like a client-space feature

Lennart Buit10:05:51

Using leiningen. I wonder tho, I wanted to configure it server side because the default user namespace has nothing, so I would say that it shouldn’t matter which client you use, you just want to drop in the ‘maintenance’ namespace so to say.

Lennart Buit10:05:39

My experience with nREPL is very limited tho


think if you can configure it in lein, do that rather


fwiw, I use user.clj as the maintenance ns for this reason


the general approach is that nREPL is mainly there to enable client-tools to serve enduser requirements


and not fulfil it directly

Lennart Buit10:05:55

I’ll try convincing lein once more

Lennart Buit11:05:57

Yeah I think I tried that, but I wasn’t too awake anymore, so I probably did something wrong ^^. Thanks for your help!




hey. just saw the issue you posted in nREPL


I just checked what you are trying to do


did you place the :init-ns inside of :repl-options?


i.e. this :repl-options {:init-ns your.namespace} inside of project.clj

Lennart Buit22:05:10

Yes, it works for lein repl but not for lein repl :connect ....

Lennart Buit07:05:06

Oh there is a difference between connecting to the nrepl server started by leiningen (which does apply your init-ns), and connecting to one you started manually (e.g. with nrepl.server/start-server) which does not. That said, my applications don’t run through leiningen, so it would still be beneficial to me if either leiningen or nREPL allows ‘forcing’ an init-ns. I amended the issue with this information.


ah right. that makes sense.


will respond in the gh issue

👍 4

just want to check: do you have a workaround right now?


release cycle for nrepl/lein etc. is not that fast

Lennart Buit13:05:43

yeah, just swapping ns manually. Usually connecting with cursive so thats not too much of a hassle!

Lennart Buit13:05:00

Thank you for asking, and once more, if there is something I can assist in let me know! Given the constraints of being an nREPL newbie, ofcourse 🙂


you can probably also ask Ian to see if he'll add the feature to cursive


(that's the cursive author)


There's no configuration flag for it


I think lein uses a custom middleware

Lennart Buit20:05:22

Sorry, I don’t quite understand. Are you saying that there is no ‘easy’ way to configure it on the nrepl server side, but that leiningen uses a custom middleware to apply its init-ns when connecting to it?


I don’t think that’s the case, actually. If I recall correctly it was just setting *ns* manually.


ha. does look like a custom middleware


Indeed! I stand corrected then. 😄


Well, I guess we really have to make this easier to set in nREPL directly - e.g. we can pass some optional initial ns to the server when starting or something along those lines.

Lennart Buit17:05:56

I’ll start a discussion on that in a GitHub issue then ^^

Lennart Buit17:05:47

also for traceability if it ends up being something that is not desirable for some reason

Lennart Buit17:05:02

Lets continue these two threads here: ^^