npm library to manage networkmanager

Hey folks,

I’ve started working on a node-js library for interacting with NetworkManager via DBus. It implements some basic functionality–scanning for access points, connecting to networks, and showing the status of the ethernet/wifi adapters.

It’s definitely a work in progress; NetworkManager has loads more functionality that could be implemented (enterprise networks, cellular modems, etc.).

If you’re interested in using it or contributing, the page is here:


Thanks for posting this. I will let others know about it in case they are asking for accessing NetworkManager through JS.

1 Like

@bblankenship yay! Thanks a lot for sharing!

I assume that you went through the same process as I did in the last couple of days:

  • digging into DBus
  • trying to use it with NodeJS
  • finding a lot of abandoned or half-assed DBus packages for NodeJS
  • wondering why a basic technology like DBus has such poor support in NodeJS
  • starting to write your own half-assed bindings
  • realizing that this is way more difficult than expected (because DBus itself has very poor docs)

I’m really confused how a basic infrastructure can have such poor docs and support in common languages (Python seems to have a lot of half-assed bindings as well but at least they appear in the recommended bindings while there seems to be no recommendation for NodeJS at all).

Sorry for venting my frustration here :stuck_out_tongue:

Thanks for sharing your approach!

@majorz: which language/ecosystem would be your recommendation to write a REST API that allows to configure the NetworkManager via DBus? I couldn’t find any REST API that does this via DBus and so I went down the rabbit hole and now I’m fairly frustrated about the whole thing :frowning:

Lol no sweat! I had the same experience. I spent a TON of time reading through the dbus api and essentially translating parts of the python network manager dbus library into typescript. I hope my library is useful to you!

I see that you based it on the dbus package. Why did you choose this one? For me it looked kind of abandoned with all the unanswered open issues …

I gave dbus-next a try because it gets more regular releases but I find it difficult to work with :stuck_out_tongue:

Should I try dbus instead?

Hey fair logic!

I went with dbus cause it has typescript bindings and seemed mostly work-able. But if I were making it now and knew about dbus-next, I’d use that instead :slight_smile:

If you’re interested in collaborating, feel free to submit an MR on the repo! I’d love to have some teammates!

1 Like

Thanks for the invitation :slight_smile: TypeScript is not my thing (yet). I tried to understand your approach but didn’t get far, but this is also caused by my poor understanding of DBus and NetworkManager. For now I will try to create my own library to get a better understanding of DBus and NetworkManager. Depending on how that turns out, I might switch over to support you :slight_smile: Right now it’s just too many new things I have to learn and TS would add another level of complexity :stuck_out_tongue:

Hi guys, just wanted to share this project with you: GitHub - balena-io-modules/nm-api: NetworkManager DBUS API

It’s an old balena project that hasn’t been updated in a while (3 years) and AFAIK we are not using the module elsewhere. But it was very helpful when I hit the same problems you describe and had to write my own code to interact with nm via dbus for this project: GitHub - balenalabs-incubator/wifi-repeater: Easily create a WiFi Access Point or WiFi repeater with balenaOS

Maybe they are of use to any of you. Cheers!