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
