Ash FrameworkThroughout this book, we’ll build Tunez, a music database app. … We’ve built an initial version of the Tunez app for you to use as a starting point. To follow along with this book, clone the app from the following repository:https://github.com/sevenseacat/tunez … Before we can start using Ash in Tunez, we’ll need to install it and configure it within the app. Tunez is a blank slate; it has a lot of the views and template logic, but no way of storing or reading data. This is where Ash comes in as our main tool for building out the domain model layer of the app, the code responsible for reading and writing data from the database, and implementing our app’s business logic.To install Ash, we’ll use the Igniter toolkit, which is already installed as a development dependency in Tunez. Igniter gives library authors tools to write smarter code generators, including installers, and we’ll see that here with the igniter.install Mix task. Run mix igniter.install ash in the tunez folder, and it will patch the mix.exs file with the new package: | $ mix igniter.install ash | | Updating project's igniter dependency ✔ | | checking for igniter in project ✔ | | compiling igniter ✔ | | compile ✔ | | | | Update: mix.exs | | | | ...| | | 35 35 | defp deps do | | 36 36 | [ | | 37 + | {:ash, "~> 3.0"}, | | 37 38 | {:phoenix, "~> 1.8.0"}, | | 38 39 | {:phoenix_ecto, "~> 4.5"}, | | ...| | | | | Modify mix.exs and install? [Y/n] |
Confirm the change, and Igniter will install and compile the latest version of the ash package. This will trigger Ash’s own installation Mix task, which will add Ash-specific formatting configuration in .formatter.exs and config/config.exs . The output is a little too long to print here, but we’ll get consistent code formatting and section ordering across all of the Ash-related modules we’ll write over the course of the project. |