# Nbb a.k.a. Node-Babashka

**URL:** https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014
**Category:** Your Projects and Libraries
**Tags:** clojurescript
**Created:** [August 8, 2021, 3:07pm UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014 "2021-08-08T15:07:34Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![borkdude](https://clojureverse.org/user_avatar/clojureverse.org/borkdude/32/306_2.png) [@borkdude](https://clojureverse.org/u/borkdude)
#### Post date: [August 8, 2021, 3:07pm UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/1 "2021-08-08T15:07:34Z")

</div>

Hi! I don’t think I’ve announced nbb here yet, so here it goes.

Nbb is a babashka-like tool but instead of based on the JVM and GraalVM native-image it targets Node.js. The main goal is to make ad-hoc scripting with CLJS (syntax) on Node.js easy to get started with. You can use any Node.js library from nbb (unlike bb where Java libraries have to be built into the image). Additionally, like bb, you might be able to use CLJS libraries using the `--classpath` argument, if those libraries are written in the subset that SCI supports. I’ve tested HoneySQL and it worked well. Like with babashka, when your project outgrows nbb, you can then migrate to a fully compiled CLJS project.

More info in the README here:

> **[GitHub - borkdude/nbb: Ad-hoc CLJS scripting on Node.js.](https://github.com/borkdude/nbb)**
>
> Ad-hoc CLJS scripting on Node.js. Contribute to borkdude/nbb development by creating an account on GitHub.

It’s still early days and nbb probably has some rough edges (please do report those), but [Chris McCormick](https://twitter.com/mccrmx) already managed to build a cool [Twitter bot](https://twitter.com/mccrmx/status/1424354480619810817) project with it!

Oh yes, nbb bundles [Reagent](https://github.com/borkdude/nbb#reagent), so you can build TUI apps with for example [Ink](https://github.com/vadimdemedes/ink).

---

<div class="post-metadata">

### Author: ![catdog](https://clojureverse.org/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@catdog](https://clojureverse.org/u/catdog)
#### Post date: [August 8, 2021, 10:30pm UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/2 "2021-08-08T22:30:04Z")

</div>

It requires bb, and bb requires graalvm. Have you been able to build graalvm from source?

---

<div class="post-metadata">

### Author: ![didibus](https://clojureverse.org/user_avatar/clojureverse.org/didibus/32/951_2.png) [@didibus](https://clojureverse.org/u/didibus)
#### Post date: [August 9, 2021, 2:07am UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/3 "2021-08-09T02:07:06Z")

</div>

I believe GraalVM is implemented in Java, so it doesn’t get built from source, what you need is to build from source another JVM with JVMCI support, which is then used to byte-compile the GraalVM java source into java bytecode, and then you use that other JVM to run GraalVM.

Basically GraalVM is a Java application.

Though I think you can then use GraalVM running in another JVM to native-image compile GraalVM itself.

---

<div class="post-metadata">

### Author: ![catdog](https://clojureverse.org/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@catdog](https://clojureverse.org/u/catdog)
#### Post date: [August 9, 2021, 6:22am UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/4 "2021-08-09T06:22:13Z")

</div>

OpenJDK 9 and above support JVMCI.

---

<div class="post-metadata">

### Author: ![borkdude](https://clojureverse.org/user_avatar/clojureverse.org/borkdude/32/306_2.png) [@borkdude](https://clojureverse.org/u/borkdude)
#### Post date: [August 9, 2021, 7:12am UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/5 "2021-08-09T07:12:31Z")

</div>

What are you folks referring to? You don’t need bb to run nbb, but it’s convenient to build nbb with bb due to the task runner. But you can do without it by just looking up the commands it uses in the bb.edn file.

---

<div class="post-metadata">

### Author: ![catdog](https://clojureverse.org/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@catdog](https://clojureverse.org/u/catdog)
#### Post date: [August 9, 2021, 9:11am UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/6 "2021-08-09T09:11:37Z")

</div>

I’m on gentoo linux. I want to build everything including graalvm from source if possible.

---

<div class="post-metadata">

### Author: ![borkdude](https://clojureverse.org/user_avatar/clojureverse.org/borkdude/32/306_2.png) [@borkdude](https://clojureverse.org/u/borkdude)
#### Post date: [August 9, 2021, 9:16am UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/7 "2021-08-09T09:16:38Z")

</div>

For nbb, it doesn’t really make sense to build bb from source as this is way too much overhead. Just look in the bb.edn for the shell commands you have to execute to build. You need the command for `bb release` followed by `npm install -g` (if you want to have nbb globally available on your system).

---

<div class="post-metadata">

### Author: ![borkdude](https://clojureverse.org/user_avatar/clojureverse.org/borkdude/32/306_2.png) [@borkdude](https://clojureverse.org/u/borkdude)
#### Post date: [August 9, 2021, 9:43am UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/8 "2021-08-09T09:43:01Z")

</div>

Just pushed a couple of fixes, so if you cloned it locally, please pull the latest commits.

---

<div class="post-metadata">

### Author: ![Markus\_Agwin](https://clojureverse.org/user_avatar/clojureverse.org/markus_agwin/32/2568_2.png) [@Markus\_Agwin](https://clojureverse.org/u/Markus_Agwin)
#### Post date: [August 9, 2021, 9:45am UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/9 "2021-08-09T09:45:36Z")

</div>

Concerning macros: in the [docs for SCI](https://github.com/borkdude/sci#macros) it says a macro is defined via a normal function having `^:sci/macro` metadata (I am using this in [Scittle](https://github.com/borkdude/scittle)). In nbb there is `defmacro`. Is there a fundamental difference between macros in Scittle vs. macros in nbb?

---

<div class="post-metadata">

### Author: ![borkdude](https://clojureverse.org/user_avatar/clojureverse.org/borkdude/32/306_2.png) [@borkdude](https://clojureverse.org/u/borkdude)
#### Post date: [August 9, 2021, 9:51am UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/10 "2021-08-09T09:51:39Z")

</div>

In code executed by SCI the only API is `defmacro`. The `^:sci/macro` metadata is for SCI configuration if you use it as a library (and perhaps creating functions with that metadata inside scripts act like macros, but this is more a leaky abstraction than a feature). Nbb is a scripting environment like Babashka where SCI is already configured for you and not exposed to the person who is writing the scripts.

---

<div class="post-metadata">

### Author: ![catdog](https://clojureverse.org/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@catdog](https://clojureverse.org/u/catdog)
#### Post date: [August 10, 2021, 1:51am UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/11 "2021-08-10T01:51:05Z")

</div>

The idea is to turn npm packages, java jars, clojure jars, bb, and nbb into gentoo packages.  
Once it’s done, gentoo users can just install it with gentoo’s package manager.

Technically, gentoo is capable of binary packages, but I prefer source packages.

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [February 8, 2022, 1:51pm UTC](https://clojureverse.org/t/nbb-a-k-a-node-babashka/8014/12 "2022-02-08T13:51:07Z")

</div>

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