You have some Elixir code in a Mix project and pushed to a Github repository. You're code-complete-ish and ready to release your shiny and fabulous v0 to the world. Read on!

Documentation: Make it easy for people to use your code

Give some love to your README

The README is often the first aspect of your project that someone will see. So, make sure it answers all the basic questions a potential user would have. Ideally, a README includes the following information:

  • A brief summary of what the code does.
  • Installation instructions. How does a user install your code?
    • This content is auto-generated by Mix if you started your project with mix new , although it may need some tweaks.
  • Usage instructions. An overview of how to use your project once it has been installed.
    • What are the main functions a user would be interested in? How are those functions used, and what do they return?
  • Contributing. If you're interested in contributions from others, you should write an invitation in the README and some instructions about how to get started - including how to run the test suite, etc. You should also include a link to a code of conduct.

Generate docs with ExDoc

Add the ex_doc dependency to your mix.exs file:

{:ex_doc, ">= 0.0.0", only: :dev}

Then, run mix deps.get. You can now generate documentation with the following command: mix docs. All of your modules and public methods will have rudimentary documentation already, but you can beef it up with @doc and @moduledoc tags. See the Elixir School Documentation page for demonstrations of how to use those tags in your code.

Publish your code to Hex

Follow the steps here to register, add the needed metadata to mix.exs, and publish. 🚢

Publish your documentation to Hexdocs

Make the lovely documentation you generated available to the world by running mix hex.docs.