Anyone read Build It With Nitrogen or used Nitrogen?

Has anyone here read Build It With Nitrogen or used the Nitrogen framework? (Build It With… by Lloyd Prentice et al. [PDF/iPad/Kindle]) I watched an old talk by Jesse Gumm about Nitrogen and the ability to write everything in Erlang (include frontend behavior) reminded me of LiveView in Elixir. Has anyone used both? If so, any thoughts on the strengths/weakness of the two? Nitrogen seems to have an uglier interface than LiveView due to heavy use of records, but it’s in Erlang and seems to be a bit simpler overall.

1 Like

Hi, sorry to necro an old thread, but I just noticed this post and thought I’d pop in.

I’m the Nitrogen guy, and one of the co-authors of the book in question.

I’m on the flip-side - I haven’t worked with Phoenix or LiveView, so I can’t compare features or relative pros/cons from a technical perspective.

But I can throw out a few pros and cons for Nitrogen in general,

Cons:

  • Small community in an already esoteric language means fewer job opportunities for a Nitrogen-specific skill-set. Instead, in the industry, Nitrogen tends to work its way into business when sysadmins and backend engineers need dashboards or admin interfaces and who want an easy way to build it without having to really mess about with JS or the frontend-vs-backend distinction.
  • I’m very slow with releases. I’ve been saying “Nitrogen 3 will be ready in a few months” for well over a year, and it is close, but not quite there yet. I’d love to be able to focus on the framework full time, but that’s not an option now. So while my day job uses Nitrogen, and I occasionally focus my time on working on the framework itself, I’m still mostly writing features for my work product.

Neither Pros nor Cons:

  • Database agnostic. There is no database support built into Nitrogen. Database integration is left up to the user, but there are enough DB adapters in the ecosystem that it’s not a big deal. I personally use sql_bridge for my own DB integration needs. It’s simple enough to get the job done.

Pros:

  • It’s a small and (I think) simple framework. There are a handful of core functions, and a pile of elements for HTML and JS abstractions.
  • Minimal magic: The only real magic (if you can call it that) in Nitrogen is the abstraction to the websocket (and ajax fallback if that fails). The rest is pretty much taken care of.
  • Flexible: It’s mostly erlang-server agnostic. Most of the popular Erlang web servers are supported (I still haven’t gotten around to adding support for Elli). You can define your own custom elements and actions, as well as your own handlers for the various almost-core functionality (like session management, caching, process registry, routing, security).
  • You don’t really have to know Javascript and maybe have a passing knowledge of HTML (though knowing both will obviously help).
  • I am a zealot about backwards compatibility. That’s part of why releases are so slow.
  • It’s about 15 years old now. Nitrogen was launched in 2008, and Rusty (Nitrogen’s creator) handed me the reins in 2011.

When I first discovered Nitrogen in 2009, it just clicked with my way of thinking. I hesitate to say “it’s the way web applications should be written,” but as a framework it proved to be highly compatible with my brain.

And I know the Erlang syntax is viewed as a wart by many. I understand the concerns, but I disagree. There’s a quality to it that hits me just right. My primary beefs with Erlang are all related to strings and binaries: I strongly dislike the binary syntax (<<"this is a binary string">> vs "This is a string that's a list", ugh). I’d love to see string become a first class type. But the overall syntax, while not exactly familiar, just feels right.

Of course, none of this is meant to disparage Elixir, Phoenix, or LiveView. I think it’s wonderful what you folks have done here and the huge community you’ve built. Indeed, I’d be lying if I didn’t say I feel a tinge of envy for Phoenix’s traction.

Anyway, that’s my spiel. If you do decide to check it out, or want a discounted (or even free) version of the book, the Erlang Forums offer the ebook as a monthly giveaway or I made a 25% off coupon code specifically for this thread here.

And if you have questions about it, I’m happy to answer them.

7 Likes