BackendTask

In an elm-pages app, each Route Module can define a value data which is a BackendTask that will be resolved before init is called. That means it is also available when the page's HTML is pre-rendered during the build step. You can also access the resolved data in head to use it for the page's SEO meta tags. page

Think of BackendTask like a Cmd or Effect. It's a special type which you pass up to the runtime to ask it to do something for you. Since Elm code is pure, it can't perform side-effects. BackendTasks will not do anything unless they're passed to the elm-pages framework. Since the framework has its own Model, update, etc., it's able to go perform side-effects to resolve those BackendTasks for you. You can think of it like a wrapper around The Elm Architecture site . page

You can think of a BackendTask as a declarative (not imperative) definition of data. It represents where to get the data from, and how to transform it (map, combine with other BackendTasks, etc.). page