What are your favorite Elixir modules/libraries? (Useful, wild, etc)

Since I’m new to and learning Elixir, I thought it would be fun to ask the community what their favorite modules were.

Specifically, what are a few modules you couldn’t live without that I should keep in my tool belt?

Also, are there any wild, experimental, or even less practical modules, that are simply fun to use/play with?

PS. To those who write, maintain, and contribute to the Elixir docs, they are amazing! Kudos. :facepunch:t3::boom: fist bumps

2 Likes

GenServer, :gen_statem, Supervisor, Plug and StatesLanguage

4 Likes

The idea of having favorite modules is strange to me, but I use Enum and Kernel all the time and I appreciate their ubiquitous utility.

5 Likes

Ecto and EctoSQL covers a lot of ground and its abstractions are interesting if a bit overwhelming sometimes.

Not having a lot of experience with ETS and the like… CubDB has resulted to be super useful, beautiful data store you can rely on, with easy to grasp query capabilities.

Norm is super fun to play with, it is a way to specify the “form” of your data so it can be validated at run-time. I have been learning a lot around “Design by Contract” thanks to it! Seeing the pros and cons compared against the static analysis tools (dialyxir, gradualixir) and methodologies (automated tests) we use on a language like elixir.

Decimal is great but it will probably come bundled with another library, like ex_money which might save you a lot of work if you ever need to handle different currencies. EEx for anything about “templating”.

I would love to play more with:

  • moebius, as an alternative to Ecto. It seems to have full-text-search query capabilities and document schemas out of the box :slight_smile:
  • drab, I’m currently invested in learning LiveView but would love to check-out what I’m missing by not using this library.
  • witchcraft, as a bunch of really powerful operators I yet don’t really grasp.

@entone already mentioned a bunch. There’s a really vast ecosystem of “GenServer derivates” when you need anything related to “distribution” or “reliability”.

6 Likes

Thanks for all the suggestions fellas! Feel free to keep them coming. :+1:

1 Like

Nimble parsec is both amazing and incredibly mindbendingly hard to use the first few times. Also basically everyone gets it as a part of elixir, so, it’s probably hiding somewhere you don’t expect.

3 Likes

Opus pipeline https://github.com/zorbash/opus

3 Likes

I stopped dead in my tracks while I was doing a hobby projects with NimbleParsec. I got some strange errors that previously defined parts of the parser can’t be found, fought for hours, and gave up. :frowning:

1 Like

Really appreciate everything you guys have shared so far! Even if some of it is still over my head. :nerd_face:

1 Like

Yeah I discovered a good pattern in nimble parsec is to fence your combinators with defparsecs set aside inside of if Mix.env == :test blocks and aggressively TDD them. This is a basic example where I discovered this pattern, in internal projects I use it even more.

2 Likes

I have been recently working with structs and map, which requires working with string and atom keys. These libraries have helped me profoundly:

  • exconstructor - Generate structs from maps
  • morphix - “Tiny library of functions to perform transforms on maps and arrays.”
1 Like

POW.

I only do webdev in Elixir I cannot see myself building web application without POW. It’s a good authentication library that does everything I need.

8 Likes

Oddly no one mentioned the must-haves that get packaged with most things I build:. elixir_uuid, credo, dialyxir, licensor, ex_doc, ex_coveralls. I use httpoison for testing a lot, and when doing web dev (not a whole lot tbh) I use hound (some prefer wallaby)

1 Like

Interesting! But how does it help? I wanted to fiddle with my parsers and test them in iex while nailing the exact combinations. Does it mean that I can’t do that and they can only be used while testing?

Obviously not I reckon so I’ll read more of your code.

2 Likes

Interesting list, bringing up two of my favorite packages that were not mentioned yet:

  • mox is great for tests and helping you build good abstractions for your application on top of pluggable behaviours

  • boundary I didn’t have the chance to use this one yet, but I’m eager to, and interested to see where this will get. It’s experimental at this point, but the idea is to help you manage your application internal module dependencies.

Cheers!

2 Likes

Just wanted to thank everyone for sharing! :+1:

1 Like

man, I forgot mox! It’s IMO the best solution if you need to mock an external service (like let’s say you shoot off a tweet or contact twilio or stripe).

I will say that figuring out how to use mox with elixir async tests is a learning curve, so don’t try too hard the first few times. Just use Mox in easy-mode, without async. Once you have the feel for basic programming in elixir and are ready to tackle some more difficult concepts, it’s time to take your mox and make it async.

1 Like

Not mentionned yet, but I use them quite often.

3 Likes