After years of building single-page applications with React and Vue, Phoenix LiveView can feel like a shortcut. You write Elixir on the server, maintain state there, and update the client when that state changes. Many interactive screens need little application-specific JavaScript and do not require a separate state-synchronization layer.
The Mental Model
A LiveView runs as a process on the Erlang VM (BEAM). It keeps server-side state and renders HTML. When the state changes, LiveView computes a diff and sends updates to the client over a WebSocket. The client applies those updates to the DOM.
def render(assigns) do
~H"""
<div>
<p>Counter: <%= @count %></p>
<button phx-click="inc">+1</button>
</div>
"""
end
def handle_event("inc", _params, socket) do
{:noreply, update(socket, :count, &(&1 + 1))}
end
There is no need to build this particular interaction around React hooks or a separate reducer. The server holds the authoritative application state.
Where LiveView Works Well
- Real-time dashboards: metrics, logs, and job status.
- Forms with complex validation: the server runs the rules and the client displays feedback.
- Internal tools: interfaces where a server connection is available and the interaction model benefits from shared state.
Where It May Not Be the Best Fit
- Static landing pages: plain HTML may be simpler when persistent interactivity is unnecessary. LiveView adds a stateful connection, although the initial page can still be server-rendered.
- Very detailed client-side interactions: sophisticated drag-and-drop, canvas editors, and highly responsive gestures may still need JavaScript hooks.
- Offline-first applications: server-backed interactions are unavailable when the connection drops unless you build separate offline behavior.
My Takeaway
For many of the internal applications I work on, LiveView significantly reduces stack complexity: one primary language, one runtime, and one authoritative state model. The trade-off is a closer connection to the server. For real-time products, that can be exactly what the product needs.