For the Uninitiated
What is Elixir?
Elixir is a language with a ruby-like syntax that’s built on top of erlang. It boasts the same concurrency features of erlang, but with a friendlier syntax.
It’s personally my favorite tool for building servers, and I’m working on a game server with it in my spare time.
What is Phoenix?
Phoenix is effectively rails for elixir, but much better IMO. It has a much more understandable structure, and frequently opts for generating code for you to extent rather than trying to build a one-size-fits-most solution into the framework itself.
It leans on Ecto as the query builder, but doesn’t give many more data fetching features than what Ecto provides already.
That’s where Ash comes in.
What is Ash
Ash is a difficult beast to explain.
It’s part ORM, part domain modeling language, part code generation framework, and part sourcery (literally).
Ash is a tool built on top of the sourcery, and spark libraries. It leverages elixir macros and defines a very simple language for describing your application’s “domain.” In ash, “domains” are collections of “resources” which have various “actions” that can operate on that resource’s data. There are also policies which describe what data can be accessed and by whom.
It uses this domain definition to do things like generate sql migrations, generate methods for basic CRUD operations, enforcing multi-tenency rules, enforcing authorization, and more with the different part of the ash ecosystem like AshAutentication
Ash Authentication
AshAuthentication is an extension to the ash framework which adds authentication concepts like Strategies, Tokens, and Identities.
I’ll go into detail on Ash Authentication in another post.
Ash Authentication Phoneix
There is an extension to Ash Authentication which provides easy integration into phoenix. It provides authentication plugs, oauth callback routes, and integrates some of AshAuthentication’s strategies (like password auth or magic links) into Phoenix.
Zach is very nice
Zach is the creator of the Ash framework and is very pleasant to interact with.
He’s very active on their discord… actually he’s very very active. I hope he’s getting enough sleep.
That’s all folks
I’m a big fan of functional programming and I really like the kind of abstractions that phoneix and ash provides. Ash is quite a bit of magic, though. I’m normally not too big a fan of magic, but, unlike when I was working with rails, I feel as though I understand most of what Ash is doing.
I’m working on a couple Ash extensions and will be posting more about them in the future.
I plan on going deep into how ash works and how to leverage the domain you describe with ash to derive as much as you can.
Stay tuned!