Looking for a tutorial on how to build a hex package from scratch

The best way to learn a language for me is to actually build a supporting library or package or gem. I’m looking for rewrite my Gophers application in Elixir and so far I haven’t really found a nice end-to-end write up of how a package is written in Elixir.

Sure, I can find how to write a loop, or how pipes work - but a more complete example would be priceless!

Even a very scoped, small packages on Github would be good enough for learning purposes, but being new to Elixir I’m not sure what’s a good example. Obviously looking at Phoenix’s code is not a good idea just like looking at Rails to learn Ruby is not a good idea.

Thanks!

2 Likes

Judging from the docs there is nothing more involved than just a config file.

http://eftimov.net/writing-elixir-library

Here’s a magic-8ball tutorial I saw last year which publishes to Hex. A quick google search turns up a few more hex publishing tutorials but in essence they are all identical. Create account -> create config -> publish.

4 Likes

Nice, appreciate that second link. I like how fast tests execute as well, coming from Ruby it’s breakneck speed.

1 Like

There’s this one too but unlike the magic 8ball it doesn’t actually do anything of note. Still it gives you another example of a mix.exs file to eyeball.

2 Likes

I built the Pragmatic package with no prior experience in building an Elixir package. The docs do cover this pretty well. Dive in.

1 Like

You probably found your answer already, but in case anyone is still looking, Elixir in Action has a lot of good examples.

I also did a 42 minute episode showing how to build a Todo Hex package in Episode 16 of LearnElixir.tv.

4 Likes