Introduction to the Ash Framework Elixir Conf 2020

3a3227652f5e333ae9bb12dd1cd025a3?s=47 Zach Daniel
September 04, 2020

Introduction to the Ash Framework Elixir Conf 2020

A declarative, resource-oriented application framework for Elixir. Currently in early alpha, targeting stable release in early 2021.

3a3227652f5e333ae9bb12dd1cd025a3?s=128

Zach Daniel

September 04, 2020
Tweet

Transcript

  1. Zach Daniel 09/04/2020 A declarative, resource-oriented application framework for Elixir

    www.ash-elixir.org Currently in early alpha, targeting stable release in early 2021 Ash Framework Introduction to the
  2. The #1 solution for driving software adoption and digital transformation

    with your remote engineering team www.variance.com Your documentation dies in the dark
  3. Whats the point?

  4. @ashframework The Ash Doctrine Convention Configuration Procedural Declarative Customize Extend

    Handwrite Derive
  5. Alpha Notice @ashframework

  6. Example App - Helpdesk @ashframework

  7. Example App - Helpdesk @ashframework

  8. Add Ash Dependency @ashframework

  9. User Resource @ashframework

  10. User Resource @ashframework

  11. User Resource @ashframework

  12. User Resource @ashframework

  13. Ticket Resource @ashframework

  14. Ticket Resource @ashframework

  15. Ticket Resource @ashframework

  16. Add Relationships to User @ashframework

  17. Configure for Postgres: User @ashframework

  18. Configure for Postgres: User @ashframework

  19. Configure for Postgres: User @ashframework

  20. Migrations @ashframework

  21. Migrations @ashframework

  22. Migrations @ashframework

  23. Adding Actions @ashframework

  24. Adding Actions @ashframework

  25. Adding Actions @ashframework

  26. Adding Actions @ashframework

  27. Adding Actions @ashframework

  28. Adding Actions @ashframework

  29. Now lets use them! @ashframework

  30. Now lets use them! @ashframework

  31. Creating a changeset @ashframework

  32. Creating a changeset @ashframework

  33. Creating a record

  34. Creating a record

  35. Creating a record

  36. Reading It Back @ashframework

  37. Reading It Back @ashframework

  38. Reading It Back @ashframework

  39. Reading It Back

  40. Attribute Requirements @ashframework

  41. Attribute Requirements @ashframework

  42. Allow Nil and Defaults @ashframework

  43. Allow Nil and Defaults @ashframework

  44. Type Constraints @ashframework

  45. Type Constraints @ashframework

  46. Validations @ashframework

  47. Changeset Errors @ashframework

  48. Setting defaults @ashframework

  49. More requirements!

  50. More requirements!

  51. More requirements!

  52. More requirements!

  53. I know what you’re thinking @ashframework

  54. @ashframework

  55. So What About the Web API? @ashframework

  56. But What About the Web API? @ashframework

  57. But What About the Web API? @ashframework

  58. But What About the Web API? @ashframework

  59. @ashframework

  60. @ashframework

  61. @ashframework

  62. @ashframework

  63. @ashframework

  64. @ashframework

  65. @ashframework

  66. Authentication @ashframework • Not handled by Ash yet • An

    “actor” is provided on the way in • Eventually, extensions will likely support it
  67. FakeUser plug @ashframework

  68. Adding AshPolicyAuthorizer @ashframework

  69. Adding our Resources

  70. Adding our Resources

  71. Adding our Resources

  72. Adding our Resources

  73. Adding our Resources

  74. Adding our Resources

  75. GET /api/users @ashframework

  76. POST /api/tickets

  77. POST /api/tickets

  78. POST /api/tickets

  79. POST /api/tickets

  80. POST /api/tickets

  81. More specific actions @ashframework

  82. More specific actions @ashframework

  83. Reacting to the Actor @ashframework • Customize changes based on

    the actor • Use policies to prevent/allow specific actors
  84. Using `changes` @ashframework

  85. Using `changes` @ashframework

  86. Using `changes` @ashframework

  87. Using `changes` @ashframework

  88. Using it in code

  89. Using it in code @ashframework

  90. Using it in code @ashframework

  91. Via the API @ashframework

  92. Via the API @ashframework

  93. POST /api/tickets/open?include=reporter

  94. POST /api/tickets/open?include=reporter

  95. POST /api/tickets/open?include=reporter

  96. Editable reporter @ashframework

  97. Editable reporter @ashframework

  98. Using `policies` @ashframework

  99. Using `policies` @ashframework

  100. Using policies @ashframework

  101. Using policies @ashframework

  102. Using policies @ashframework

  103. Using policies @ashframework

  104. Using policies @ashframework

  105. Using policies @ashframework

  106. Using policies @ashframework

  107. Bypass Policies @ashframework

  108. Using policies @ashframework

  109. Using policies @ashframework

  110. Trying it out @ashframework

  111. Trying it out @ashframework

  112. Trying it out @ashframework

  113. Trying it out @ashframework

  114. Trying it out @ashframework

  115. Trying it out @ashframework

  116. Reading Tickets @ashframework

  117. Reading Tickets @ashframework

  118. Reading Tickets @ashframework

  119. Reading Tickets @ashframework

  120. Reading Tickets @ashframework

  121. GET /api/tickets @ashframework

  122. GET /api/tickets @ashframework

  123. GET /api/tickets?filter[reporter]=:user_id @ashframework

  124. GET /api/tickets?filter[reporter]=:user_id @ashframework

  125. Filter Templates @ashframework

  126. Filter Templates @ashframework

  127. Filter Templates @ashframework

  128. Access Type - filter @ashframework

  129. GET /api/tickets @ashframework

  130. Calculations and Aggregates @ashframework

  131. Calculations and Aggregates @ashframework

  132. Calculations and Aggregates @ashframework

  133. Calculations and Aggregates @ashframework

  134. Calculations and Aggregates @ashframework

  135. Calculations and Aggregates @ashframework

  136. Calculations and Aggregates @ashframework

  137. Calculations and Aggregates @ashframework

  138. Calculations and Aggregates @ashframework

  139. Calculations and Aggregates @ashframework

  140. Calculations and Aggregates @ashframework

  141. Calculations and Aggregates @ashframework

  142. Calculations and Aggregates @ashframework

  143. Calculations and Aggregates @ashframework

  144. Calculations and Aggregates @ashframework

  145. Taking stock @ashframework • Our tickets resource has a great

    “open” action. • Authorization for reads • Missing more actions, e.g `close` and `respond` • Calculations and aggregates that can be requested by the API • Its all in one top level namespace
  146. Multiple Apis @ashframework

  147. Multiple Apis @ashframework

  148. Multiple Apis @ashframework

  149. Router @ashframework

  150. @ashframework

  151. None
  152. None
  153. But what about GraphQL?

  154. AshGraphQL

  155. What we missed • ETS, Mnesia, CSV data layers, its

    easy to write your own • Resources aren’t tables - CQRS/DDD • Built in tooling for extending Ash • Escape Hatches • Writing an extension is easy @ashframework
  156. Roadmap • Tests, Fixes, Refactors • Ash GraphQL • Subscriptions

    • Customizations (First come, first serve) @ashframework
  157. • Andrew Callahan @andrewcallahan • Mike Binns @1stAvenger • Paul

    Schoenfelder @gotbones • Jason Goldberger @json_louis • Andrew Summers @_asummers • Vince Herr linkedin.com/in/vincent-herr-6b12b021/ • Cresten StClair cresten.pizza • Percy Hatcherson linkedin.com/in/percyhatcherson/ • Meredith Bollinger @heymereb Acknowledgements @ashframework
  158. Join the Ash Community • Visit the community page on

    www.ash-elixir.org • Book office hours • GH issues • Join the Slack channel and Google group • Follow Ash on Twitter @ashframework @ashframework