liveBook · Manning

Mix project

As explained in Elixir in Action, Third Edition

A Mix project is an Elixir project organized with configuration, source files, compiled artifacts, and related development resources managed by Mix.

A Mix project organizes a multifile Elixir system into source files, tests, dependencies, compiled artifacts, and project tasks. Mix creates the structure, builds the code, and provides the commands used to run and test it. section 2.7.2 section 7.1

Create a project with mix new, then run commands from its directory. Files under lib are included automatically, including files in nested folders; compilation places BEAM artifacts in ebin, which Mix adds to the VM load path. section 2.7.2 section 7.1

Common project operations include:

  • mix compile builds the project and generates the application. section 2.7.2
  • mix test runs the generated and project tests. section 2.7.2
  • iex -S mix compiles the project and opens an Elixir shell with its modules available. section 7.1
  • mix run -e invokes a runner or expression and can terminate when the work finishes. section 13.1.2

A project-backed interactive session

A todo project can be created with mix new todo, entered with iex -S mix, and used to start Todo.Server, add an entry, and retrieve entries. This turns a collection of modules into an executable concurrent system. section 7.1

$ cd my_project
$ mix compile

$ mix compile
Compiling 1 file (.ex)
Generated my_project app

The command sequence shows project creation’s compiled output and the generated application artifact. section 2.7.2

How Elixir in Action, Third Edition covers it

How deep it goes
Explains creation, layout, compilation, testing, shell access, and runners, while deferring detailed Mix features.
Examples
Uses the generated my_project application, a todo project, an interactive Todo.Server session, and a JSON-decoding script.
What it assumes
Assumes basic Elixir command-line use and introduces the project workflow without requiring detailed Mix knowledge.
What you can do after
Operate/configure a Mix project by creating it, compiling modules, running tests, opening its shell, and launching runners.
How it connects
Connects source organization with dependencies, tests, OTP applications, BEAM artifacts, and concurrent systems.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.