undeadlol1
This question was inspired by this thread: Open Source Projects Using Ash Framework as Learning Resources.
The Ash framework is amazing, but as a newcomer to Elixir, getting started with it can be quite challenging. To build a real application, you need to understand at least five different Ash libraries—such as ash_phoenix, ash_auth, ash_policies, ash_postgres, ash_rbac, and ash_json_api/ash_graphql—along with Phoenix and Phoenix LiveView. While learning these technologies is certainly possible, and the learning curve isn’t the steepest, integrating them all into a working application can be incredibly difficult.
Moreover, different people have different learning styles. Personally, when learning a new technology, I often search for something like a “React boilerplate project” and start hacking away. By the end of the process, not only do I learn the new technology, but I also have something practical to show for it. Unfortunately, I haven’t been able to do the same with Ash—I just get overwhelmed by the number of required libraries.
Another reason why boilerplate projects are valuable is that no one likes reinventing the wheel. While building everything from scratch can be a great learning experience, it becomes tedious when it’s not your first time around.
Note: The closest things to a starter project I could find are these repositories:
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
This is definitely something that we’re working towards with igniter. We also heavily dislike reinventing wheels. There is one small usage of the
--exampleflag in Ash core which generates a few resources when you install Ash, likemix igniter.install ash --example. What I would like to do with that is have--exampleactually be extended and built on top of by the other extensions. So that if you have--examplepresent when installingAshGraphqlit will modify the example resources or create new example resources that use GraphQL, that kind of thing.There are some complexities in making that process fluid, however, and what may instead be likely is that we improve how far our generators go. For example, you can do this today:
to get a resource that uses GraphQL and PostgreSQL. However, it doesn’t preconfigure any mutations or queries, and so it has the same discoverability problem.
However we end up solving this, it will almost certainly be accessible as a check box in the new Ash installer at https://ash-hq.org
zachdaniel
Also I know an example app isn’t really what you’re looking for vs a boilerplate generator, but decent timing on this other post: Tololo eCommerce: Ash Example
Pal
Doesn’t that fit the bill of a starter project?
Then just hack away, fleshing out resources with ash admin:
I’m no elixir (or Ash) expert, but I think the Ash learning resources (including the Tunez book) are really great and getting better.
undeadlol1
In my eyes a starter project should have the following:
None of this are impossible to figure out on my own, but it will take a long time. Having some ready to read or to copypasted code would be nice
undeadlol1
I recently purchased the Ash book and have been working through it. It has really helped me understand Ash much better. I’m also planning to use Tunez as a starter project for my next application because I find the code accessible.
I’d like to mention that I wish there were more emphasis on using the terminal and specifically on Igniter in the documentation.
For example, while experimenting with Tunez, I decided to check out ash_admin. I went to the library’s README to see what steps were needed to add the library. There were two sections: “With Igniter (Recommended)” and “Manual.” Naturally, the “Manual” approach had many steps, and I was eager to follow them—especially since I didn’t know what Igniter was and was reluctant to install another global terminal command.
After a quick Google search, I initially assumed that Igniter was simply equivalent to running commands like “npm install some_library” or “dart pub add some_library,” which is common in many ecosystems.
However, I decided to give Igniter a chance, and I was completely blown away. After running the command:
I was pleasantly surprised to see that around ten files were updated. Everything was configured properly—there was no additional configuration required. All I had to do was start the server and visit http://localhost:4000/admin, and a complete admin page was available.
This single terminal command added an entire admin interface to the application with no extra steps or hidden gotchas. The more I work with Ash and Igniter, the more I appreciate that these tools work consistently across the ecosystem. In contrast to other ecosystems where code generators and terminal tasks can be shallow, the Elixir ecosystem offers powerful, well-integrated tooling.
I really wish the documentation and guides emphasized this strength more clearly. I wish someone had told me upfront that terminal commands in the Elixir ecosystem are robust and that I should embrace them when I see the “Recommended” label.
The reason I am writing all of this is because I think Igniter can be a solution to many of my problems. If I have to simply run some terminal command instead of figuring stuff out I consider that a win.
zachdaniel
I think that we do emphasize igniter pretty well in the book, using it to install the various components we might need etc. i.e
mix igniter.install ash_authentication,mix igniter.install ash_authentication_phoenixandmix ash_authentication.add_strategy.Igniter & Ash are intended to bring us to a different point than the concept of your standard boilerplate, where you don’t have to opt into the kitchen sink of someone else’s application, you can just install the things you need when you need them.
So if I started out with an application with some example resources:
Now if you want authentication in your app, you just say
(these examples are real, you can run them)
And if you realized that you wanted password authentication too, you don’t have to go back to a boilerplate and copy/paste or something, you just
mix ash_authentication.add_strategy password.Honestly there is still a lot more work to do on this front, but I think we’re moving in the right direction.
Some major pieces left:
I’d like to do is to make the
--exampleflag do things in other extensions as well. Currently onlyashreacts to it to create some example resources.Another thing is to make the
mix ash.extendcommand do more than it currently does, for example:mix ash.extend MyApp.Helpdesk.Ticket graphqlwill add theAshGraphqlextension to a resource, but does not configure any mutations and queries etc.mix ash.gen.resource MyApp.MyResourceshould merge things into the resource in question instead of just ignoring if the resource already exists.sevenseacat
I was thinking of this yesterday, I’d love to add simple generators like
ash.gen.calculationandash.gen.changethat generates skeleton modules. They’d be super small, but I think it’d be pretty convenientzachdaniel
That’s a cool idea
mix ash.gen.calculation Name.Of.Calc --resource MyApp.Foo.Barcould also add it to the resource module. I think you might be surprised at just how actually doable that is.For an adventurous soul:
mix igniter.gen.task ash.gen.calculationIgniter.Project.Module.create_moduleto create the moduleAsh.Resource.Igniterand copy theadd_new_attributelogic into aadd_new_calculationfunction and adjust it accordinglyAlternatively, there are plans to make
mix ash.gen.resourcemerge into existing resources, so we could add--calculation foo:type:Moduleto that task, and if the module doesn’t exist it is created as a shell (by delegating tomix ash.gen.calculation) meaning that the calculation gen task doesn’t know about resources it just creates the shell of a calculation.undeadlol1
Thank you for this command. I will try it out
Woah. You just blew my mind. Didn’t know it was possible.
Sidenote: not a day goes by without my mind being blown. Elixir ecosystem is just something else. I have been doing programming for a while now and I have never seen anything like it. It is just so pragmatic. In other ecosystems after a while I feel like I am wrestling against the tools, but here I always feel like somebody is holding my hand and helping out
undeadlol1
I’m not sure where else to post this, so I’m writing it here.
Thank you for writing (or co-authoring) the Ash Framework book. As I mentioned in my original post, I struggled for weeks trying to wrap my head around Ash and its associated libraries—it was an on-and-off process of trying and failing. But after reading the book, I can finally say that I truly understand Ash and I feel confident writing my own code with it. Thank you for making this possible.
I know that the official documentation and guides took a lot of effort to create, and I don’t want to diminish that. However, without the book, I was really struggling. Your work has made a significant difference in my learning journey.